Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-05-31 10:14:37


In:

   html/boost_proto/user_s_guide/extending_proto.html

there's:
<--------- cut here -----------
  namespace boost { namespace proto
{
     // A specialization of generate<> that causes expression in the
     // calculator_domain to be wrapped in the calculator<> wrapper.
     template< typename Expr >
     struct generate< calculator_domain, Expr >
     {
         typedef calculator< Expr > type;

         static type make( Expr const & expr )
         {
             return type( expr );
         }
     };
}}

This instructs Proto to wrap all expressions in the calculator_domain in
the calculator<> wrapper.
>--------- cut here -----------
OTOH, in:

   libs/xpressive/proto/example/calc3.cpp

there's:
<--------- cut here -----------
// Tell proto how to generate expressions in the calculator_domain
struct calculator_domain
   : proto::domain<proto::generator<calculator_expression> >
{};
>--------- cut here -----------

which suggests to me that there's 2 different ways to wrap expressions
in a particular domain. Is that right? If so, what are the advantages
of one over the other method?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk