Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-04-22 08:16:07


David Abrahams wrote:

>John Torjo <john.lists_at_[hidden]> writes:
>
>
>
>>>time, you don't have to name the element type ;-)
>>>
>>>
>>>
>>>
>>>
>>of course ;) the element type is deduced from the container type.
>>For instance, if you want a constant range, just do:
>>crange<const container> r(cont);
>>//... etc
>>
>>
>
>But container is usually "spelt something<element_type>", so I'd pick
>naming the element type over naming the container type any day.
>
>
>
But it's technically not possible.
Think about:

typedef std::deque<int> d_array;
typedef std::vector<int> v_array;

d_array d;
v_array v;

crange<d_array> r(d); // ok
crange<v_array> r(v); // ok

However, had I used
crange<int> r(d); // how do I know what iterators to keep inside?
crange<int> r(v); // how do I know what iterators to keep inside?

Best,
John


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