wichtounet / etl

Blazing-fast Expression Templates Library (ETL) with GPU support, in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expression constructor not working

yixuan opened this issue Β· comments

Great library. πŸ‘

However I encountered some issues with the example on README page. The code below does not compile:

etl::dyn_vector<double> a({1.0,2.0,3.0});
etl::dyn_vector<double> b({3.0,2.0,1.0});
etl::dyn_vector<double> c(1.4 * (a + b) / b + b + a / 1.2);

However this works:

etl::dyn_vector<double> a({1.0,2.0,3.0});
etl::dyn_vector<double> b({3.0,2.0,1.0});
etl::dyn_vector<double> c;
c = 1.4 * (a + b) / b + b + a / 1.2;

I haven't investigated the code carefully, but it seems that the assignment operator is well defined but not the expression constructor. Since the example is taken from README, I suppose this is not by design. Any thoughts?

Hi,

Thanks :)

Indeed, the README is not correct. For now, it's not possible anymore to use the constructor for this.

A shorter way of doing it, is:

auto c = s(1.4 * (a + b) / b + b + a / 1.2);

but I think the c = expression is the best way to go.

If you think it should work directly with the constructor, feel free to say it and we'll discuss it :)

The README is fixed in 113fc09

Baptiste

Personally I have no preference, so the suggested way works for me.

It is nice that you fixed the documentation. The examples are actually very important for users' first impression. :D

It is nice that you fixed the documentation. The examples are actually very important for users' first impression. :D

Agreed :P
I'm quite happy you mentioned that ;)