Created on 2005-11-03.00:00:00 last changed 172 months ago
[ Martin suggests removing the second sentence in [cons.slice] as well. ]
Change [cons.slice]:
1 -
The default constructor for slice creates a slice which specifies no elements.The default constructor is equivalent to slice(0, 0, 0). A default constructor is provided only to permit the declaration of arrays of slices. The constructor with arguments for a slice takes a start, length, and stride parameter.
Change [gslice.cons]:
1 -
The default constructor creates a gslice which specifies no elements.The default constructor is equivalent to gslice(0, valarray<size_t>(), valarray<size_t>()). The constructor with arguments builds a gslice based on a specification of start, lengths, and strides, as explained in the previous section.
If one explicitly constructs a slice or glice with the default constructor, does the standard require this slice to have any usable state? It says "creates a slice which specifies no elements", which could be interpreted two ways:
Here is a bit of code to illustrate:
#include <iostream> #include <valarray> int main() { std::valarray<int> v(10); std::valarray<int> v2 = v[std::slice()]; std::cout << "v[slice()].size() = " << v2.size() << '\n'; }
Is the behavior undefined? Or should the output be:
v[slice()].size() = 0
There is a similar question and wording for gslice at 26.3.6.1p1.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg3007 |
2005-11-03 00:00:00 | admin | create |