Fix some corechecker warnings (#470)

* Improve const correctness in string_span

* Improve const correctness in bounds_tests.cpp and byte_tests.cpp

* Improve const correctness in span_tests.cpp

* Improve const correctness in utils_tests.cpp

* Use gsl::owner for dynamically allocated memory in string_span_tests.cpp

* Improve const correctness in string_span_tests.cpp

* Improve const correctness for strided_span_tests.cpp
This commit is contained in:
MikeGitb
2017-04-02 21:30:49 +02:00
committed by Neil MacIntosh
parent 3300602653
commit ade86caa92
7 changed files with 469 additions and 468 deletions

View File

@ -577,7 +577,7 @@ template <class CharT, std::ptrdiff_t Extent, class T,
std::is_convertible<T, gsl::basic_string_span<std::add_const_t<CharT>>>::value>>
bool operator==(const gsl::basic_string_span<CharT, Extent>& one, const T& other) GSL_NOEXCEPT
{
gsl::basic_string_span<std::add_const_t<CharT>> tmp(other);
const gsl::basic_string_span<std::add_const_t<CharT>> tmp(other);
#ifdef GSL_MSVC_NO_CPP14_STD_EQUAL
return (one.size() == tmp.size()) && std::equal(one.begin(), one.end(), tmp.begin());
#else
@ -624,7 +624,7 @@ template <typename CharT, std::ptrdiff_t Extent = gsl::dynamic_extent, typename
T, gsl::basic_string_span<std::add_const_t<CharT>, Extent>>::value>>
bool operator<(gsl::basic_string_span<CharT, Extent> one, const T& other) GSL_NOEXCEPT
{
gsl::basic_string_span<std::add_const_t<CharT>, Extent> tmp(other);
const gsl::basic_string_span<std::add_const_t<CharT>, Extent> tmp(other);
return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end());
}