Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-03-09 18:46:47


Gennaro Prota <gennaro_prota_at_[hidden]> writes:

> On Sun, 09 Mar 2003 09:11:05 -0500, David Abrahams
> <dave_at_[hidden]> wrote:
>
>>Gennaro Prota <gennaro_prota_at_[hidden]> writes:
>>
>>> On Sat, 08 Mar 2003 15:31:58 -0500, David Abrahams
>>> <dave_at_[hidden]> wrote:
>>>
>>>
>>>>"Make 'em MPL-compatible metafunctions."
>>> ^^^
>>> |---- which ones?
>>
>>All of the traits. For example:
>>
>>template <class T>
>>struct const_min
>> : integral_c<T, /* calculate the value */>
>>{};
>
>
> Well, why hardcoding that dependency?

You don't have to; it was just an example implementation. Another
implementation would be:

template <class T>
struct const_min
{
    BOOST_STATIC_CONSTANT(T, value = /*whatever*/);
    typedef const_min<T> type;
    typedef T value_type;
};

> At most I would see the mpl
> versions *in addition* to the ordinary ones. Of course, the former can
> be constructed upon the latter by the user
>
>
> template <typename T>
> struct mpl_const_min :
> integral_c<T, const_min<T> :: value > {};
>
>
> and everyone pays only for what he/she uses.

Users also end up paying for what the library didn't provide.

>>> PS: why the quotes? :-)
>>
>>I couldn't resist (?)
>
>
> I still don't understand... it must be one of those C++ programmers
> eccentricities ;-)

Bingo.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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