Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-08-27 07:22:28


> From: <scleary_at_[hidden]>
> > Hmm. I don't see a really good solution from either of
> these. This
> > is just an explanation of the problem, as I see it: how can we
> > provide a 'traits' concept that allows the adding of user traits?
>
> template<class Tag, class A> struct extensible_traits;
>
> struct is_even_tag {};
>
> template<class Int> struct extensible_traits<is_even_tag, Int>
> {
> typedef bool result_type;
> static result_type f(Int i) { return i % 2 == 0; }
> };

Excellent idea, Peter!

        -Steve


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