Boost logo

Proto :

Subject: Re: [proto] pod_generator Question
From: Nate Knight (Nate.Knight_at_[hidden])
Date: 2011-02-12 14:55:35


> On 2/12/2011 7:17 AM, Nate Knight wrote:
>> I see in the Proto documentation a trick for getting the Proto operator overloads found by ADL using something like
>>
>> template<class T, class Dummy = proto::is_proto_expr>
>> struct my_complex
>> {
>> BOOST_PROTO_EXTENDS(
>> typename proto::terminal<std::complex<T> >::type
>> , my_complex<T>
>> , proto::default_domain
>> )
>> };
>>
>> The proto::pod_generator class template, however, expects its argument to be a one argument class template.
>> So, something like
>>
>> struct my_domain : proto::domain< proto::pod_generator< my_complex> > {};
>>
>> won't work because my_complex is a two argument class template (even though its got one default argument).
>
> It wouldn't work anyway because pod_generator expects that it's
> argument's template parameter is a Proto expression. my_complex's
> template argument is (presumably) a scalar. Generators are for wrapping
> bare expressions in custom wrappers. my_complex is already a wrapped
> Proto expression.
>

Eric, thanks for the response.

I think I misunderstood the intent of these comments in the documentation. 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.




Proto list run by eric at boostpro.com