|
Proto : |
Subject: Re: [proto] pod_generator Question
From: Eric Niebler (eric_at_[hidden])
Date: 2011-02-13 02:01:37
On 2/13/2011 2:55 AM, Nate Knight wrote:
>
> I have some external non-proto terminals I've adapted using
> BOOST_PROTO_DEFINE_OPERATORS. I was trying to figure out how to get
> the terminals picked up by the operator overloads without importing
> them all from the namespace they are defined in every time I wanted
> to build an expression. I just needed to make sure my terminals were
> tied to the namespace in which I put the
> BOOST_PROTO_DEFINE_OPERATORS.
>
> I think I'm starting to figure this out, but I'm sure I'm going to
> have a few more mixups before I'm done.
The second argument to BOOST_PROTO_DEFINE_OPERATORS is a domain. When
defining a domain you (usually) specify a generator with an expression
wrapper. What are you using for a domain, and how do you define it?
When I want an end-user-friendly terminal type, I derive it from the
expression wrapper class, like this:
template<class Expr> struct my_wrapper;
struct my_domain : domain< generator<my_wrapper> > {};
template<class Expr> struct my_wrapper
: extends< Expr, my_wrapper<Expr>, my_domain > {
...
};
class my_int : my_wrapper< terminal<int>::type > {
...
};
Sounds like pod-ness is important to you, so this scheme won't work. Is
that the problem you're having?
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Proto list run by eric at boostpro.com