
Boost : 
From: Jeremy Siek (jsiek_at_[hidden])
Date: 20010728 15:11:04
On Sat, 28 Jul 2001, Aleksey Gurtovoy wrote:
>
> My thoughts too. And the same about other basic sequence operations: 'size',
> 'empty', 'front' and 'back'. That's what we have here at work:
>
> template<class Sequence>
> struct begin_algorithm
> {
> typedef typename sequence_algorithm_traits<Sequence>::iterator
> result_type;
> static result_type result(Sequence& seq)
> {
> return seq.begin();
> }
> };
>
> template<class Sequence>
> inline
> typename begin_algorithm<Sequence>::result_type
> begin(Sequence& seq)
> {
> return begin_algorithm<Sequence>::result(seq);
> }
I'm curious, what's the reason for the added complexity here? Why not
just:
template <class Sequence>
typename sequence_traits<Sequence>::iterator
begin(Sequence& s)
{
return s.begin();
}
and then let people overload begin() for unusual sequence types? Are you
worried about the "swap" problem?
Cheers,
Jeremy

Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
Summer Manager, AT&T Research phone: (973) 3608185

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