$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-07-27 06:16:45
From: "Ed Brey" <edbrey_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
>
> > template<class R> void sort(R & r)
> > {
> > std::sort(r.begin(), r.end());
> > }
> >
> > template<class T> void sort(std::list<T> & l)
> > {
> > l.sort();
> > }
>
> I don't follow. Why does the std::list<T>& overload prevent the other
> function from being R const& ?
Technically it doesn't; I'm thinking in std terms:
Library requirements for sort:
template<class R> void sort(R const & r);
Specialization:
template<class T> void sort(std::list<T> & l);
Does not meet requirements, undefined behavior.
-- Peter Dimov Multi Media Ltd.