Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto]: How to use complex grammars in a domain/extension
From: Roland Bock (rbock_at_[hidden])
Date: 2010-09-20 16:57:38


On 09/20/2010 08:04 PM, joel falcou wrote:
>
> then it'll work.
>
Sorry, I need to ask again:

// -------------------------------------------------
#include<boost/proto/proto.hpp>

using namespace boost;

typedef proto::terminal<proto::_>::type terminal;

struct addition:
    proto::or_
    <
       terminal,
       proto::plus<addition, addition>
>
{};

struct equation:
    proto::or_
    <
       proto::equal_to<addition, addition>
>
{};

template<class Expr>
struct extension;

struct my_domain
   : proto::domain<
         proto::pod_generator< extension>
       , equation
>
{};

template<class Expr>
struct extension
{
     BOOST_PROTO_EXTENDS(
         Expr
       , extension<Expr>
       , my_domain
     )
};

int main()
{
     extension<proto::terminal<int>::type> i;

     i == i; // Error
}
// -------------------------------------------------

I know it has to be obvious, but I just can't see it...

Regards,

Roland


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