On Feb 26, 2011, at 4:55 AM, Eric Niebler wrote:

> On 2/26/2011 8:18 AM, Nate Knight wrote:
>> 
>> int main()
>> {
>>    la::state_type x = {1.0,2.0};
>>    la::state_type const& xc = x;
>> 
>>    // this compiles
>>    la::EvalOpt()( lit(x)[1] );
>> 
>>    // this fails to compile
>>    //la::EvalOpt()( lit(xc)[1] );
>> 
>>    // this fails to compile
>>    //_default<>()( la::Optimize()( boost::proto::lit(x)[1] ) );
>> 
>>    // this compiles
>>    _default<>()( as_expr( la::Optimize()( boost::proto::lit(x)[1] ) ) );
>> }
> 
> 
> I think I know what's causing this. Can you try compiling with
> BOOST_PROTO_STRICT_RESULT_OF?
> 

Eric,

Thanks for the information.  Compiling with BOOST_PROTO_STRICT_RESULT_OF
allows the first commented line to compile.  I guess we'll wait to hear from 
Joel about 
the impact of this change on the run times of his library.  

The second commented line does not compile.  This seems to be because there are 
no
'const Expr&' overloads of boost::proto::transform::operator().  Is this 
correct? The pertinent 
part of the compiler error (from clang) is 

boost/proto/transform/impl.hpp:96:9: note: candidate function 
    [with Expr =
      boost::proto::exprns_::expr<boost::proto::tag::subscript, 
boost::proto::argsns_::list2<const 
boost::proto::utility::literal<std::tr1::array<double, 2> &,
      boost::proto::domainns_::default_domain> &, const 
boost::proto::exprns_::expr<boost::proto::tag::terminal, 
boost::proto::argsns_::term<const int &>, 0> &>, 2>]
    not viable: no known conversion from 'typename 
boost::proto::detail::apply_transform<transform_type (const expr<subscript, 
list2<const literal<array<double, 2>
      &, default_domain> &, expr<terminal, term<const int &>, 0> >, 2> 
&)>::result_type' (aka 
'boost::proto::exprns_::expr<boost::proto::tag::subscript,
      boost::proto::argsns_::list2<const 
boost::proto::utility::literal<std::tr1::array<double, 2> &, 
boost::proto::domainns_::default_domain> &, const
      boost::proto::exprns_::expr<boost::proto::tag::terminal, 
boost::proto::argsns_::term<const int &>, 0> &>, 2>') to
      'boost::proto::exprns_::expr<boost::proto::tag::subscript, 
boost::proto::argsns_::list2<const 
boost::proto::utility::literal<std::tr1::array<double, 2> &,
      boost::proto::domainns_::default_domain> &, const 
boost::proto::exprns_::expr<boost::proto::tag::terminal, 
boost::proto::argsns_::term<const int &>, 0> &>, 2>
      &' for 1st argument
        BOOST_PROTO_TRANSFORM_(PrimitiveTransform, X)

Nate
_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to