Boost logo

Boost :

Subject: Re: [boost] [type_erasure] Review started (July 18-27, 2012)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-07-30 09:43:10


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>,
  ...>
{};

In Christ,
Steven Watanabe


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