|
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-21 03:15:10
On 09/21/2010 08:54 AM, Joel Falcou wrote:
> On 20/09/10 22:57, Roland Bock wrote:
>> typedef proto::terminal<proto::_>::type terminal;
>>
>> struct addition:
>> proto::or_
>> <
>> terminal,
>> proto::plus<addition, addition>
>> >
>> {};
>
> terminal is a terminal type, not a terminal grammar:
>
> struct addition :
> proto::or_< proto::terminal<proto::_>
> , proto::plus<addition,addition>
> > {};
That did not make a difference:
// -----------------------------------------------------------------
#include<complex>
#include<boost/proto/proto.hpp>
using namespace boost;
struct addition :
proto::or_
<
proto::terminal<proto::_>
, 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
}
// -----------------------------------------------------------------
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