Boost logo

Boost :

Subject: Re: [boost] Formal Review: Boost.RangeEx
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-02-25 15:24:10

----- Original Message -----
From: "Giovanni Piero Deretta" <gpderetta_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 25, 2009 7:59 PM
Subject: Re: [boost] Formal Review: Boost.RangeEx

On Wed, Feb 25, 2009 at 7:07 PM, Vicente Botet <vicente.botet_at_[hidden]> wrote:

> > If another boost library want to overload interrupt(T) for other types that do not provide a member interrupt function, the developer needs just to
> >
> > template <typename T>
> > typename boost::enable_if<a_specific_condition<T>,
> > void
> > >::type
> > interrupt(T& act) {
> > // ...
> > }
> >
> I think this would break horribly if two libraries define slightly
> overlapping conditions, so I do not think it is a great idea. It might
> work with non auto concepts in c++0x.

Do you prefer to have the same algorithm in different namespaces? Overlaping conditions are possible in the same way that overloads can make ambigous a call. The single difference is that instead of typing your arguments you are adding constraints respect to the concept the parameter is a model of. That is,

Imagine we define a function working for Threads at the boost scope
    interrupt(boost::thread& act);

Now I define a joiner that can also be interruped
    template <typename T>
    interrupt(boost::interthreads::joiner<T>& act);

Both functions have a common semantic. Overloading should works well, but we need to do partial specialization. Every joiner<T> is interrupted the same way, no mater the type T.

Am I missing something?

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