diff options
author | paweldac <paweldac@users.noreply.github.com> | 2018-02-21 22:33:07 +0100 |
---|---|---|
committer | Neil MacIntosh <neilmac@fb.com> | 2018-02-21 13:33:07 -0800 |
commit | b3870ca02077ac39a306478ae6259124e46b8d9f (patch) | |
tree | 4bcd6d7101e41d21f1b3c6e4b9fbe10f44a24609 /tests/utils_tests.cpp | |
parent | 73db6ef98fb508e3e60a6d412ce8abeeb3acfd8c (diff) | |
download | Microsoft-GSL-b3870ca02077ac39a306478ae6259124e46b8d9f.tar.gz |
add gsl::index typedef (#620)
* rename index in multi_span to span_index
gsl::index is name reserved for different type
* add gsl::index typedef
cppcoreguidelines referece: ES.107: Don't use unsigned for subscripts, prefer gsl::index
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-subscripts
* rename span_index to multi_span_index
Diffstat (limited to 'tests/utils_tests.cpp')
-rw-r--r-- | tests/utils_tests.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/utils_tests.cpp b/tests/utils_tests.cpp index 610efbf..587b0a1 100644 --- a/tests/utils_tests.cpp +++ b/tests/utils_tests.cpp @@ -18,13 +18,20 @@ #include <gsl/gsl_util> // for narrow, finally, narrow_cast, narrowing_e... -#include <algorithm> // for move -#include <functional> // for reference_wrapper, _Bind_helper<>::type -#include <limits> // for numeric_limits -#include <stdint.h> // for uint32_t, int32_t +#include <algorithm> // for move +#include <functional> // for reference_wrapper, _Bind_helper<>::type +#include <limits> // for numeric_limits +#include <stdint.h> // for uint32_t, int32_t +#include <type_traits> // for is_same using namespace gsl; +TEST_CASE("sanity check for gsl::index typedef") +{ + static_assert(std::is_same<gsl::index, std::ptrdiff_t>::value, + "gsl::index represents wrong arithmetic type"); +} + void f(int& i) { i += 1; } TEST_CASE("finally_lambda") |