Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-14 09:46:15

"Brock Peabody" <brock.peabody_at_[hidden]> writes:

>> -----Original Message-----
>> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
>> On Behalf Of Brian McNamara
>> "Me too."
>> In my opinion, "named conformance" is the right way to design most
>> interfaces, whereas "structural conformance" (as above) is the wrong
>> way. What you really want to say is
>> template <typename T> T* clone(const T& t) {
>> return mpl::if_<
>> is_clonable<T>,
>> use_clone_function,
>> use_copy_constructor
>> >::type::clone(t);
>> }
> After thinking about it some more, I find myself agreeing with you and Dave.
> Is there a good use then for member detection, other than types?

Types aren't special. Yes, there's a good use for this sort of thing,
but as I said you have to be careful to detect that you're not just
getting accidental structural conformance. Just look through the
library for BOOST_MPL_AUX_HAS_XXX to see various places and ways it's

Incidentally, the evolution working group is considering various
ideas for adding concept checking to the language, most of which
center around structural, rather than named, conformance.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at