Boost logo

Boost :

Subject: Re: [boost] [type_erasure] Review started (July 18-27, 2012)
From: Fabio Fracassi (f.fracassi_at_[hidden])
Date: 2012-07-30 11:58:23


On 7/30/12 3:43 PM, Steven Watanabe wrote:
> AMDG
>
> On 07/29/2012 12:28 PM, Fabio Fracassi wrote:
>>
>> b.2. I cannot define a concept that has more than one function directly,
>> i.e. I have to define concepts for push_back and size and then compose
>> them (in this case 35 lines of code). This is of course mainly an issue
>> of syntactic sugar, but in Stevens concept definition boiler plate and
>> interface information (member name, arguments, composition lists) are
>> intermixed.
>>
>> I seem to recall that there was some discussion about having some macros
>> to simplify the boilerplate. I think something along the lines of
>>
>> BOOST_CREATE_CONCEPT(container_concept, typename T,
>> (void (push_back, T),
>> void (size))
>> )
>>
>> wouldn't be too bad.
>>
>
> What about this:
>
> BOOST_TYPE_ERASURE_MEMBERS((push_back)(size)...)
>
> template<class V, class T = _self>
> struct container_concept : mpl::vector<
> has_push_back<void(const V&), T>,
> has_size<std::size_t(), const T>,
> ...>
> {};
>

I like it. (even though I do not yet understand how it maps to what is
currently there.)

It still exposes some implementation details (like mpl:vector and the T
template parameter), but this is a purely aesthetic point.

best regards

Fabio


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk