Resolves compiler code analysis warning ...\gsl\include\gsl\string_span(101): warning C26496: The variable 'str_span' is assigned only once, mark it as const (con.4: https://go.microsoft.com/fwlink/p/?LinkID=784969).
changes:
- minimal cmake version updated to 3.7(first version with .natvis file handling)
- updated cmake version in readme file
- GSL.natvis file is added only to VS projects
* 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();
}
* travis.yml clean up
- Remove trailling spaces
- Move notification setting from the bottom to the top
- Set Linux as default OS
- Simplify cache directory
- Add banners around different configurations
* Update CMake installation routine
- Make it depend on variable (easier to update)
- Simplify code a bit
* Re-organize build matrix and LLVM install
- make logic depend on a single COMPILER variable
- Update LLVM installation process
* Update compilers to latest stable version
* Made string_span details::string_length() generic
removed overloads & specialized classes
Creating string_spans using `char16_t` and `char32_t` was not possible
without creating new specializations and function overloads.
This patch makes details::string_length() generic removing the need to
extend the overloads and specializations.
* added type aliases for string_span types char16_t and char32_t
* Added char16_t & char32_t overloads for ensure_z
* added string_span tests for char16_T & char32_t
* added zstring type aliases for char16_t & char32_t
* Added tests for char16_t & char31_t zstring and string_span types
* applies clang format to <gsl/string_span>
* Clang format tests/string_span_tests.cpp
* Removed ensure_z() overloads as they don't add functionality.
using the GSL with MSVC 2017 causes the following warning"
`'std::copy_n::_Unchecked_iterators::_Deprecate': Call to 'std::copy_n'`
This patch removes this since the point of this code is to deal with this issue.
Catch was being installed to the root of the cmake project. This
violated the source code tree itself and would not work at all if GSL
was being consumed with add_subdirectory.
CMake will now install catch to the build tree under /dependencies.
not called even by the unit test (it was calling the "container" ctor
instead). I mimicked the constructor taking a non-const std::array to fix
the issue.
* Fixes issue with dereferencing operator issue #491 introduced in PR #513
dereferencing operator added in PR#513 returned a copy of the object
instead of reference to it.
Adding decltype(auto) as return type of operator* fixes this issue.
* added more tests for not_null::operator*
* Restricting usage of owner<T> to pointer types
* Removing an additional type that was created for testing
* Added comment about the new constraint on owner
* Adding dereference operator to not_null
* Removing dereference operator changes for not-null
* Removing dereference operator changes for not-null
* Review comments