|
Boost Users : |
Subject: Re: [Boost-users] [Boost.Assign] list_of::range without an initial (single) element?
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2010-06-17 07:46:23
Nat Goodspeed skrev:
> Thorsten Ottosen wrote:
>
>> Nat Goodspeed skrev:
>>> Thorsten Ottosen wrote:
>>>
>>>>>> However, list_of<int>() inserts a default value (so that
>>>>>> list_of<int>().range(a).range(b) == {0,1,2,3,4}).
>>>>
>>>> Maybe we should add
>>>>
>>>> empty_list_of<int>()
>>>>
>>>> ? It's quite trivial to add.
>>>
>>> Does list_of<T>() have a default value for its T parameter?
>>
>> No, how could it?
... as it cannot assume what T will be.
> In that case, I'm confused about why list_of<int>() inserts a default
> value.
It was a consistency issue. Consider
list_of<int>()(42); // 0, 42
list_of<int>(42)(); // 42, 0
list_of(42)(); // 42, 0
would you expect that to be any different?
-Thorsten
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net