* Added support for returning fixed-spize spans from subspan().
* Addressed issues from code review.
* Took simpler approach to static data member.
* Subtle fix to support MSVC 15.
* Helps to not introduce extraneous >
* fixed noexept warnings
- Removed conditional compilation for throwing version of GSL
vs fail_fast because we don't want users of the code to see
differences in the span interface dependent on error mechanism
chosen
- Removed noexcept from functions that may fail at runtime
- Fixed CppCoreCheck warnings related to missing and incorrect
noexcept
- do not warn on unnown attributes for GCC and Clang
* remove suppress that does not compiler for clang and gcc
* rewrite span subspan checks to help optimizations
* Removed checking pointer for null for subspans. We would never
check pointer for null in between ptr and ptr+size in the
original span, so there seems to be no reason to do so for
subspans, provided that the subspan's boundaries are ensured
to be within the range of the original span's boundaries.
This change allows to simplify generated code, for example, to
remove 5 out of 9 branches in code generated from the following
by MSVC, and 4 out 8 branches in clang and gcc-generated code:
span<int> mysubspan(int* p, std::ptrdiff_t size, std::ptrdiff_t i)
{
if (p != nullptr)
{
span<int> s = { p, size };
return s.subspan(i);
}
return { nullptr };
}
Similar effects are achieved for dynamic subspans of static spans,
where in the following code we remove 2 out of 4 branchs in MSVC
and GCC-generated code:
int test_dynamic_subspan_of_static_span(std::ptrdiff_t i)
{
int x[] = { 0,1,2,3,4,5 };
span<int, 6> s = { x };
auto subspan = s.subspan(i);
return subspan.size();
}
Fixes#510.
* Constrain the converting constructor to not participate in overload resolution when IsConst is true, so that it is never a copy constructor.
* Use Default Member Initializers for span_iterator's data members so that the default constructor can be explicitly defaulted.
* Declare all members of span_iterator GSL_NOEXCEPT: they only throw when contract violations throw.
* Don't use & in operator-> since evil types may overload it.
Project files were not following the clang-format style. For people
using IDEs were clang-format is always run after a save this would
cause unwanted changes.
This commit only applies "clang-format -i" to files.
* Add value_type to span
Currently I'm working on project which involves a lot of `span`s and mocking via Google Mock. Unfortunately a lot of standard matchers requires `value_type` type definition inside container which `gsl::span` lacks.
This pull request add `value_type` type definition inside `gsl::span`
* Strip cv from value_type of span and span_iterator
* Nest "gsl" directory inside a new "include" directory.
* Cleanup the _MSC_VER conditionals a bit; use constexpr on VS2017+.
* Don't #define noexcept on non-Microsoft implementations.
* Workaround VS2017 bug in multi_span. (Also implement == and != for static_bounds_dynamic_range_t because I'm an EoP semantic soundness snob.)
Fixes#441.