Boost logo

Boost :

Subject: Re: [boost] [type_erasure] default implementation of concept signatures
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-05-28 12:52:21


AMDG

On 05/28/2011 09:42 AM, Vicente Botet wrote:
> Concepts are able to define default implementations if the type doesn't
> provides the specific signature. For example in 20.1.2 Comparisons the
> concept LessThanComparable defines a default for implementation for
>
> bool operator>(U const& a, T const& b) { return b < a; }
> bool operator<=(U const& a, T const& b) { return !(b < a); }
> bool operator>=(T const& a, U const& b) { return !(a < b); }
>
> In the definition of the concept less_than_comparable in Boost.Any, you
> define the implementation of these operators in function of operator<(), but
> if the types provide the specific signature the specific function is not
> called. I guess that the default implementation of for example operator<=
> should use operator< only if the the underlying types don't provide
> operator<=.
>
> What do you think?
>

I don't think this is worth the extra
complexity. Do you know of any real
case where it will either
a) change the behavior of a program or,
b) make the program more efficient?

It will definitely make the vtable
larger.

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