
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?
Maybe introduce no-params list_of<T>() to produce an empty list, while list_of<T>(const T&) keeps its current implementation? That would seem to behave intuitively in both cases...
Just to be clear, you want list_of() to be empty_list_of<*any type*>(), and for the type of the list to be deduced by the first argument: list_of()(42); would be a list of ints with one value (42). ? If so, I think this syntax is possible, but I am worried that the difference between list_of() and list_of<T>() is too subtle. -Thorsten