|
Boost Users : |
Subject: Re: [Boost-users] phoenix function problem
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-04-23 01:58:08
On 4/23/2010 1:49 AM, Olaf Peter wrote:
> Hi,
>
> in the example attached, the 1st test case fails on runtime:
>
> test_phoenix_fcn.cpp(105): test 'at_c<0>( rlc )&& at_c<1>( rlc )&&
> at_c<2>( rlc )' failed in function 'int main(int, char**)'
> test_phoenix_fcn:
> /home/olaf/Projects/programming/cpp/boost/trunk/boost/optional/optional.hpp:591:
> typename boost::optional_detail::optional_base<T>::reference_type
> boost::optional<T>::get() [with T = double]: Assertion
> `this->is_initialized()' failed.
> Aborted
>
>
> the 2nd (with defined WANT_TO_HAVE) doesn't compile. This is the goal.
>
> Where is my misunderstanding here? To to get it working correctly?
Your operator()s are wrong (C++ error, unrelated to phoenix).
Try this:
#if WANT_TO_HAVE
template <typename T, typename ID>
struct result { typedef vector_type type; };
vector_type operator()( const vector_type& v, rlc ) const
{
return fusion::as_nview<0, 1, 2>( v );
}
vector_type operator()( const vector_type& v, lcr ) const
{
return fusion::as_nview<2, 0, 1>( v );
}
#else
Regards,
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon
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