You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It fails because there's a comparaison between signed and unsigned int, revealing that buffer.size_bytes is signed, it's a ptrdiff_t.
Looking at GSL code it looks like most size_type for span are ptrdiff_t and thus are signed, however if I understand correctly span<> philosophy the size shouldn't be negative.
Can span<> encapsulate "reverse" range ?
The text was updated successfully, but these errors were encountered:
Hi @vlj, this was discussed in #171. Essentially, the designers of the GSL believe that a signed integer is the correct choice for the indexing and measurement type. To address your second question, you are correct, the size should not be negative in a span. I'm not quite sure what you mean by a "reverse range", though.
Thanks.
About reverse range, I was wondering if the possibility of having negative size was kept for span defined by pointer to the last element (and thus offset to the other end of the span is negative).
Hi,
I set visual studio 2015 to treat errors as warning.
With the following code snippets:
void fill_fragment_constants_buffer(gsl::span buffer, const some_pointer_type *) const
{
...
Expects(buffer.size_bytes() >= FragmentConstantOffsetCache.size() * 4u);
...
}
It fails because there's a comparaison between signed and unsigned int, revealing that buffer.size_bytes is signed, it's a ptrdiff_t.
Looking at GSL code it looks like most size_type for span are ptrdiff_t and thus are signed, however if I understand correctly span<> philosophy the size shouldn't be negative.
Can span<> encapsulate "reverse" range ?
The text was updated successfully, but these errors were encountered: