Boost logo

Boost :

From: Thomas Maeder (maeder_at_[hidden])
Date: 2001-07-26 11:54:52


David Abrahams wrote:
>
> > Could another benefit of providing a container interface wrapper be that,
> > for those algorithms for which an optimised version is available as a
> > member of the container (or is _only_ available in member form, such as
> > list::sort() ), the optimised member version could be selected
> > automatically (via specialisation)...?
>
> Maybe not, since the user is allowed to completely replace the
> implementation of std::list<T> via specialization when T is a UDT.

I don't see the problem. Attempting to sort() using the container interface
wrapper would result in a compiler error if the specialization doesn't
provide a sort member function, which is exactly the right thing IMHO.

Why should

class MyType {};

namespace std
{
  template <>
  class list<MyType>
  {
  };
}

std::list<MyType> aList;
sort(aList);

work if

aList.sort();

doesn't?


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