|
Boost Users : |
Subject: Re: [Boost-users] [Proto] Storing an Expression Template as a Data Member
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2011-01-06 11:55:42
2011/1/6 Hossein Haeri <powerprogman_at_[hidden]>
> Dear Eric,
>
> I will certainly have another read over make_expr. But, I have a feeling
> that I might not have explained what I need very well. So, with some
> connection to the function streaming thing we were in contact on previous
> threads, here is an example:
>
> MyClass mc(_1 >> &f >> &g >> &h);
> mc.set_input(-61.1);
> cout << mc.value();//returns h(g(f(-61.1)))
>
> Now, are you telling me that I can store that "_1 >> &f >> &g >> &h" bit in
> a data member of mc using make_expr? If so, what will the type of that data
> member be? Or, are you suggesting a totally different design?
This is not possible in C++. It becomes possible if you specify the type of
the argument:
MyClass<double> mc(...);
Now mc.set_input can only be called with double.
Roman Perepelitsa.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net