mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
moved gsl::index to gsl_util
This commit is contained in:
parent
2e4213a11a
commit
8f5110b8ae
@ -21,7 +21,6 @@
|
||||
#include <gsl/gsl_assert> // Ensures/Expects
|
||||
#include <gsl/gsl_byte> // byte
|
||||
#include <gsl/gsl_util> // finally()/narrow()/narrow_cast()...
|
||||
#include <gsl/index> // index
|
||||
#include <gsl/multi_span> // multi_span, strided_span...
|
||||
#include <gsl/pointers> // owner, not_null
|
||||
#include <gsl/span> // span
|
||||
|
@ -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 F>
|
||||
class final_action
|
||||
|
@ -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 <cstddef> // for ptrdiff_t
|
||||
|
||||
namespace gsl
|
||||
{
|
||||
using index = std::ptrdiff_t;
|
||||
}
|
||||
|
||||
#endif // GSL_INDEX_H
|
@ -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)
|
||||
|
@ -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 <catch/catch.hpp>
|
||||
#include <type_traits> // for is_same
|
||||
|
||||
#include <gsl/index> // for index
|
||||
|
||||
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");
|
||||
}
|
@ -22,9 +22,16 @@
|
||||
#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")
|
||||
|
Loading…
Reference in New Issue
Block a user