Boost logo

Proto :

Subject: Re: [proto] [proto-11] expression extension
From: Eric Niebler (eric_at_[hidden])
Date: 2012-06-06 02:24:11


On 6/5/2012 11:10 PM, Mathias Gaunard wrote:
> On 03/06/2012 09:41, Eric Niebler wrote:
>>
>> Hey all, this is just an FYI. I've been hard at work at a ground-up
>> redesign of proto for C++11. I've gotten far enough along that I know
>> what expression extension will look like, so I thought I'd share. This
>> should interest those who want finer control over how expressions in
>> their domain are constructed. Without further ado:
>>
>> template<typename Tag, typename Args>
>> struct MyExpr;
>>
>> struct MyDomain
>> : proto::domain<MyDomain>
>> {
>> struct make_expr
>> : proto::make_custom_expr<MyExpr, MyDomain>
>> {};
>> };
>>
>> template<typename Tag, typename Args>
>> struct MyExpr
>
> Wouldn't it be more interesting for make_custom_expr to take a
> meta-function class?

The template template parameter is distasteful, I agree, but I can shave
template instantiations this way. There's no need to instantiate a
nested apply template for every new expression type created. Especially
now with template aliases, it's quite painless to adapt a template to
have the interface that make_custom_expr expects. That was my reasoning,
at least.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com