Date: Thu, 28 Nov 2019 12:37:05 +0100
Could we add operators at() to span<> container?
value_type & at(size_type n);
const value_type & at(size_type n) const;
they would have same behaviour as in vector, array - that is throws an
exception if n is outside of size of the container.
1) can we have that?
2) if yes, then should I write a proposal paper or how else to help in this?
Can it make it to C++20?
Imo it is a notable defect that span can not be a drop in replacement
for code taking a (reference to) array/vector that is using at().
3)
By the way, in case of span that has specific size (not dynamic_extent)
we could perhaps have a static assert and the function might be constexpr.
value_type & at(size_type n);
const value_type & at(size_type n) const;
they would have same behaviour as in vector, array - that is throws an
exception if n is outside of size of the container.
1) can we have that?
2) if yes, then should I write a proposal paper or how else to help in this?
Can it make it to C++20?
Imo it is a notable defect that span can not be a drop in replacement
for code taking a (reference to) array/vector that is using at().
3)
By the way, in case of span that has specific size (not dynamic_extent)
we could perhaps have a static assert and the function might be constexpr.
Received on 2019-11-28 05:39:29