|
Boost Users : |
Subject: Re: [Boost-users] [phoenix] lazy function to reference or const reference
From: alfC (alfredo.correa_at_[hidden])
Date: 2011-04-04 13:47:33
On Apr 4, 2:53 am, Thomas Heller <thom.hel..._at_[hidden]> wrote:
> I messed up in the type calculation ;)
> Thanks for reporting, the issue is now fixed on trunk.
>
great, thanks, now it works.
What I wanted to achieve was a function class that is at the same time
a lazy function,
A a;
a(5.); //calls the usual operator()
a(arg1 + 1.); // build a phoenix expression
maybe implemented like below. However I can't, the compilation error
was
usr/include/boost/type_traits/is_abstract.hpp:72:4: error: incomplete
type A not allowed.
Is there an elegant way to achieve this? -- Thanks -- Alfredo
#include<boost/phoenix/core.hpp>
#include<boost/phoenix/function.hpp>
struct A : boost::phoenix::function<A&> {
A() : boost::phoenix::function<A&>(*this){}
template <typename Arg>
struct result{
typedef double type;
};
using boost::phoenix::function<A&>::operator();
template<typename Arg>
double operator()(Arg arg1) const{
return 5.;
}
};
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