Boost logo

Boost :

Subject: Re: [boost] [Review] Type Traits Extension by Frederic Bron - Review summary and decision
From: Max Sobolev (macsmr_at_[hidden])
Date: 2011-04-22 08:49:07


On 21.04.2011 23:13, Stewart, Robert wrote:
> Remember that "has_" implies ownership or inherent characteristic which doesn't apply to a namespace scope operator.

Class must have only intrinsic member functions, without which it
doesn't working. Extended part of interface defines out of class body
(perhaps in a separate module) in the same namespace, in terms of
intrinsic member functions. This decrease coupling of code.

(This C++ Software Construction approach was clearly described and
proposed in Czarnecki/Eisenecker "Generative Programming". - S.Meyers
agree; H.Sutter agree; D.Abrahams :) agree.)

Consider Barton/Nackman trick as it presents in Boost.Operators library:
boost::equality_comparable<T> require from T operator < is being defined
(as member or free operator function, doesn't matter). Operators >, <=,
>= are generated automatically as free operator functions due to
inheritance.

But there is no difference between 4 operators <, >, <= and >= from
point of view its meaning and "status": they all makes interface of
class T. Operators >, <=, >= aren't second class citizens, even if
operator < is define as member operator function.

-- 
- Do you speak English? Мужик с глубоким вздохом: - Yes I do. А хули толку?

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