diff --git a/include/gsl/gsl b/include/gsl/gsl index 6415d48..55862eb 100644 --- a/include/gsl/gsl +++ b/include/gsl/gsl @@ -21,7 +21,6 @@ #include // Ensures/Expects #include // byte #include // finally()/narrow()/narrow_cast()... -#include // index #include // multi_span, strided_span... #include // owner, not_null #include // span diff --git a/include/gsl/gsl_util b/include/gsl/gsl_util index eee63e7..58e0a37 100644 --- a/include/gsl/gsl_util +++ b/include/gsl/gsl_util @@ -43,6 +43,9 @@ namespace gsl // GSL.util: utilities // +// index type for all container indexes/subscripts/sizes +using index = std::ptrdiff_t; + // final_action allows you to ensure something gets run at the end of a scope template class final_action diff --git a/include/gsl/index b/include/gsl/index deleted file mode 100644 index 176860c..0000000 --- a/include/gsl/index +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_INDEX_H -#define GSL_INDEX_H - -#include // for ptrdiff_t - -namespace gsl -{ -using index = std::ptrdiff_t; -} - -#endif // GSL_INDEX_H diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 544d1cc..86ce5a4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -101,4 +101,3 @@ add_gsl_test(utils_tests) add_gsl_test(owner_tests) add_gsl_test(byte_tests) add_gsl_test(algorithm_tests) -add_gsl_test(index_test) diff --git a/tests/index_test.cpp b/tests/index_test.cpp deleted file mode 100644 index 761e70f..0000000 --- a/tests/index_test.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include // for is_same - -#include // for index - -TEST_CASE("sanity check for gsl::index typedef") -{ - static_assert(std::is_same::value, - "gsl::index represents wrong arithmetic type"); -} 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 // for narrow, finally, narrow_cast, narrowing_e... -#include // for move -#include // for reference_wrapper, _Bind_helper<>::type -#include // for numeric_limits -#include // for uint32_t, int32_t +#include // for move +#include // for reference_wrapper, _Bind_helper<>::type +#include // for numeric_limits +#include // for uint32_t, int32_t +#include // for is_same using namespace gsl; +TEST_CASE("sanity check for gsl::index typedef") +{ + static_assert(std::is_same::value, + "gsl::index represents wrong arithmetic type"); +} + void f(int& i) { i += 1; } TEST_CASE("finally_lambda")