Re: [proto] Nested Transforms

2011-02-28 Thread Nate Knight

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_::exprboost::proto::tag::subscript, 
boost::proto::argsns_::list2const 
boost::proto::utility::literalstd::tr1::arraydouble, 2 ,
  boost::proto::domainns_::default_domain , const 
boost::proto::exprns_::exprboost::proto::tag::terminal, 
boost::proto::argsns_::termconst int , 0 , 2]
not viable: no known conversion from 'typename 
boost::proto::detail::apply_transformtransform_type (const exprsubscript, 
list2const literalarraydouble, 2
  , default_domain , exprterminal, termconst int , 0 , 2 
)::result_type' (aka 
'boost::proto::exprns_::exprboost::proto::tag::subscript,
  boost::proto::argsns_::list2const 
boost::proto::utility::literalstd::tr1::arraydouble, 2 , 
boost::proto::domainns_::default_domain , const
  boost::proto::exprns_::exprboost::proto::tag::terminal, 
boost::proto::argsns_::termconst int , 0 , 2') to
  'boost::proto::exprns_::exprboost::proto::tag::subscript, 
boost::proto::argsns_::list2const 
boost::proto::utility::literalstd::tr1::arraydouble, 2 ,
  boost::proto::domainns_::default_domain , const 
boost::proto::exprns_::exprboost::proto::tag::terminal, 
boost::proto::argsns_::termconst 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


Re: [proto] Nested Transforms

2011-02-28 Thread Eric Niebler
On 2/28/2011 11:40 PM, Nate Knight wrote:
 
 On Feb 26, 2011, at 4:55 AM, Eric Niebler wrote:

 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 

snip

That's correct. This code compiles on trunk. I made a late fix that
didn't make it into 1.46. If we ship a point release, I'll merge it over.

But even with this fix, it can crop up in other circumstances. This is a
Proto gotcha. It's missing a bunch of overloads in the interest of
compile times (transform_impl is instantiated /everywhere/), but I need
to reconsider this because you're not the first to get bitten by this.

If you file a bug, I'll get around to it eventually. Some day, I'll use
rvalue refs and this problem will just go away.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com
___
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto