2020-02-14 18:24:46 -05:00
///////////////////////////////////////////////////////////////////////////////
//
// 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 <gtest/gtest.h>
# include <gsl/gsl_byte> // for byte
# include <gsl/span> // for span, span_iterator, operator==, operator!=
# include <array> // for array
# include <cstddef> // for ptrdiff_t
# include <iterator> // for reverse_iterator, operator-, operator==
# include <type_traits> // for integral_constant<>::value, is_default_co...
# include <utility>
2020-03-17 18:04:58 -04:00
# include <vector> // for vector
2020-02-14 18:24:46 -05:00
using namespace std ;
using namespace gsl ;
// Below are tests that verify the gsl interface support the same things as the std
// Ranges and Concepts support need to be added later.
struct Base
{
} ;
struct Derived : Base
{
} ;
static_assert ( std : : is_convertible < Derived * , Base * > : : value , " std::is_convertible<Derived*, Base*> " ) ;
static_assert ( ! std : : is_convertible < Derived ( * ) [ ] , Base ( * ) [ ] > : : value ,
" !std::is_convertible<Derived(*)[], Base(*)[]> " ) ;
2020-04-09 13:34:58 -04:00
// int*(*) [], int const* const(*)[] was identified as an issue in CWG330 and the resolution was provided with N4261
// The changes were not backported to all versions of the compilers that GSL supports.
// The `if constexpr` should prevent codegen from happening if it is not supported however a few compilers continue to complain about the logic within.
2020-04-09 14:51:59 -04:00
// Filtering g++ version < 8, clang version < 7, and XCode 9.4 and 10.1 which looks to be Apple clang versions 9.1 and 10.0.
2020-04-09 13:34:58 -04:00
# if (defined(_MSC_VER)) || \
( defined ( __GNUC__ ) & & __GNUC__ > 7 ) | | \
2020-04-09 18:56:26 -04:00
( defined ( __APPLE__ ) & & defined ( __clang_major__ ) & & __clang_major__ > 10 ) | | \
( ! defined ( __APPLE__ ) & & defined ( __clang__ ) & & __clang_major__ > 6 )
2020-03-19 17:08:04 -04:00
template < class = void >
void ArrayConvertibilityCheck ( )
2020-02-14 18:24:46 -05:00
{
2020-03-17 18:02:00 -04:00
# if __cplusplus >= 201703l
2020-03-19 17:08:04 -04:00
if constexpr ( std : : is_convertible < int * ( * ) [ ] , int const * const ( * ) [ ] > : : value )
2020-03-17 16:53:13 -04:00
{
2020-03-17 18:13:26 -04:00
std : : array < int * , 3 > stl_nullptr { { nullptr , nullptr , nullptr } } ;
2020-03-17 16:53:13 -04:00
gsl : : span < const int * const > sp_const_nullptr_1 { stl_nullptr } ;
EXPECT_TRUE ( sp_const_nullptr_1 . data ( ) = = stl_nullptr . data ( ) ) ;
EXPECT_TRUE ( sp_const_nullptr_1 . size ( ) = = 3 ) ;
span < const int * const > sp_const_nullptr_2 { std : : as_const ( stl_nullptr ) } ;
EXPECT_TRUE ( sp_const_nullptr_2 . data ( ) = = stl_nullptr . data ( ) ) ;
EXPECT_TRUE ( sp_const_nullptr_2 . size ( ) = = 3 ) ;
2020-04-08 17:38:01 -04:00
static_assert ( std : : is_same < decltype ( span { stl_nullptr } ) , span < int * , 3 > > : : value ,
" std::is_same< decltype(span{stl_nullptr}), span<int*, 3>>::value " ) ;
static_assert (
std : : is_same < decltype ( span { std : : as_const ( stl_nullptr ) } ) , span < int * const , 3 > > : : value ,
" std::is_same< decltype(span{std::as_const(stl_nullptr)}), span<int* const, "
" 3>>::value " ) ;
2020-03-17 16:53:13 -04:00
}
2020-03-17 18:02:00 -04:00
# endif
2020-03-19 17:08:04 -04:00
}
2020-04-08 17:38:01 -04:00
# else
template < class = void >
void ArrayConvertibilityCheck ( ) { }
# endif
2020-03-19 17:08:04 -04:00
TEST ( span_compatibility_tests , assertion_tests )
{
int arr [ 3 ] { 10 , 20 , 30 } ;
std : : array < int , 3 > stl { { 100 , 200 , 300 } } ;
ArrayConvertibilityCheck ( ) ;
2020-02-14 18:24:46 -05:00
{
gsl : : span < int > sp_dyn ;
2020-02-14 19:13:21 -05:00
EXPECT_TRUE ( sp_dyn . data ( ) = = nullptr ) ;
EXPECT_TRUE ( sp_dyn . size ( ) = = 0 ) ;
EXPECT_TRUE ( sp_dyn . empty ( ) ) ;
2020-02-14 18:24:46 -05:00
}
{
gsl : : span < int , 0 > sp_zero ;
2020-02-14 19:13:21 -05:00
EXPECT_TRUE ( sp_zero . data ( ) = = nullptr ) ;
EXPECT_TRUE ( sp_zero . size ( ) = = 0 ) ;
EXPECT_TRUE ( sp_zero . empty ( ) ) ;
2020-02-14 18:24:46 -05:00
gsl : : span < int > sp_dyn_a ( arr , 3 ) ;
gsl : : span < int > sp_dyn_b ( begin ( arr ) , 3 ) ;
EXPECT_TRUE ( sp_dyn_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_dyn_b . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_dyn_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_dyn_b . size ( ) = = 3 ) ;
gsl : : span < int , 3 > sp_three_a ( arr , 3 ) ;
gsl : : span < int , 3 > sp_three_b ( begin ( arr ) , 3 ) ;
EXPECT_TRUE ( sp_three_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_three_b . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_three_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_three_b . size ( ) = = 3 ) ;
gsl : : span < const int > sp_const_a ( arr , 3 ) ;
gsl : : span < const int > sp_const_b ( begin ( arr ) , 3 ) ;
EXPECT_TRUE ( sp_const_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_b . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_b . size ( ) = = 3 ) ;
# if __cplusplus >= 201703l
gsl : : span < const int > sp_const_c ( std : : as_const ( arr ) , 3 ) ;
EXPECT_TRUE ( sp_const_c . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_c . size ( ) = = 3 ) ;
# endif // __cplusplus >= 201703l
gsl : : span < const int > sp_const_d ( cbegin ( arr ) , 3 ) ;
EXPECT_TRUE ( sp_const_d . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_d . size ( ) = = 3 ) ;
}
{
gsl : : span < int > sp_dyn_a ( begin ( arr ) , std : : end ( arr ) ) ;
EXPECT_TRUE ( sp_dyn_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_dyn_a . size ( ) = = 3 ) ;
gsl : : span < int , 3 > sp_three_a ( begin ( arr ) , std : : end ( arr ) ) ;
EXPECT_TRUE ( sp_three_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_three_a . size ( ) = = 3 ) ;
gsl : : span < const int > sp_const_a ( begin ( arr ) , std : : end ( arr ) ) ;
gsl : : span < const int > sp_const_b ( begin ( arr ) , std : : cend ( arr ) ) ;
gsl : : span < const int > sp_const_c ( cbegin ( arr ) , std : : end ( arr ) ) ;
gsl : : span < const int > sp_const_d ( cbegin ( arr ) , std : : cend ( arr ) ) ;
EXPECT_TRUE ( sp_const_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_b . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_c . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_d . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_b . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_c . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_d . size ( ) = = 3 ) ;
}
{
gsl : : span < int > sp_dyn_a ( arr ) ;
gsl : : span < int > sp_dyn_b ( stl ) ;
gsl : : span < int > sp_dyn_c { stl } ;
gsl : : span < const int > sp_dyn_d { stl } ;
EXPECT_TRUE ( sp_dyn_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_dyn_b . data ( ) = = stl . data ( ) ) ;
EXPECT_TRUE ( sp_dyn_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_dyn_b . size ( ) = = 3 ) ;
gsl : : span < int , 3 > sp_three_a ( arr ) ;
gsl : : span < int , 3 > sp_three_b ( stl ) ;
EXPECT_TRUE ( sp_three_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_three_b . data ( ) = = stl . data ( ) ) ;
EXPECT_TRUE ( sp_three_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_three_b . size ( ) = = 3 ) ;
gsl : : span < const int > sp_const_w ( arr ) ;
gsl : : span < const int > sp_const_y ( stl ) ;
EXPECT_TRUE ( sp_const_w . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_y . data ( ) = = stl . data ( ) ) ;
EXPECT_TRUE ( sp_const_w . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_y . size ( ) = = 3 ) ;
# if __cplusplus >= 201703l
gsl : : span < const int > sp_const_x ( std : : as_const ( arr ) ) ;
EXPECT_TRUE ( sp_const_x . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_x . size ( ) = = 3 ) ;
gsl : : span < const int > sp_const_z ( std : : as_const ( stl ) ) ;
EXPECT_TRUE ( sp_const_z . data ( ) = = stl . data ( ) ) ;
EXPECT_TRUE ( sp_const_z . size ( ) = = 3 ) ;
# endif // __cplusplus >= 201703l
}
{
const gsl : : span < int > orig_dyn ( arr ) ;
const gsl : : span < int , 3 > orig_three ( arr ) ;
const gsl : : span < const int > orig_const_dyn ( arr ) ;
const gsl : : span < const int , 3 > orig_const_three ( arr ) ;
gsl : : span < int > sp_a ( orig_dyn ) ;
gsl : : span < int > sp_b ( orig_three ) ;
gsl : : span < int , 3 > sp_c ( orig_three ) ;
gsl : : span < const int > sp_d ( orig_dyn ) ;
gsl : : span < const int > sp_e ( orig_three ) ;
gsl : : span < const int > sp_f ( orig_const_dyn ) ;
gsl : : span < const int > sp_g ( orig_const_three ) ;
gsl : : span < const int , 3 > sp_h ( orig_three ) ;
gsl : : span < const int , 3 > sp_i ( orig_const_three ) ;
EXPECT_TRUE ( sp_a . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_b . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_c . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_d . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_e . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_f . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_g . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_h . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_i . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_a . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_b . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_c . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_d . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_e . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_f . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_g . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_h . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_i . size ( ) = = 3 ) ;
}
{
gsl : : span < int > sp_dyn ( arr ) ;
gsl : : span < int , 3 > sp_three ( arr ) ;
gsl : : span < const int > sp_const_dyn ( arr ) ;
gsl : : span < const int , 3 > sp_const_three ( arr ) ;
EXPECT_TRUE ( sp_dyn . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_three . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_dyn . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_const_three . data ( ) = = std : : begin ( arr ) ) ;
EXPECT_TRUE ( sp_dyn . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_three . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_dyn . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_three . size ( ) = = 3 ) ;
int other [ 4 ] { 12 , 34 , 56 , 78 } ;
sp_dyn = gsl : : span < int > { other } ;
sp_three = gsl : : span < int , 3 > { stl } ;
sp_const_dyn = gsl : : span < const int > { other } ;
sp_const_three = gsl : : span < const int , 3 > { stl } ;
EXPECT_TRUE ( sp_dyn . data ( ) = = std : : begin ( other ) ) ;
EXPECT_TRUE ( sp_three . data ( ) = = stl . data ( ) ) ;
EXPECT_TRUE ( sp_const_dyn . data ( ) = = std : : begin ( other ) ) ;
EXPECT_TRUE ( sp_const_three . data ( ) = = stl . data ( ) ) ;
EXPECT_TRUE ( sp_dyn . size ( ) = = 4 ) ;
EXPECT_TRUE ( sp_three . size ( ) = = 3 ) ;
EXPECT_TRUE ( sp_const_dyn . size ( ) = = 4 ) ;
EXPECT_TRUE ( sp_const_three . size ( ) = = 3 ) ;
}
{
gsl : : span < int > : : iterator it_dyn { } ;
{
gsl : : span < int > sp_dyn ( arr ) ;
it_dyn = sp_dyn . begin ( ) ;
}
EXPECT_TRUE ( * it_dyn = = arr [ 0 ] ) ;
EXPECT_TRUE ( it_dyn [ 2 ] = = arr [ 2 ] ) ;
gsl : : span < int , 3 > : : iterator it_three { } ;
{
gsl : : span < int , 3 > sp_three ( stl ) ;
it_three = sp_three . begin ( ) ;
}
EXPECT_TRUE ( * it_three = = stl [ 0 ] ) ;
EXPECT_TRUE ( it_three [ 2 ] = = stl [ 2 ] ) ;
}
{
int sequence [ 9 ] { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 } ;
const gsl : : span < int > sp_dyn ( sequence ) ;
const gsl : : span < int , 9 > sp_nine ( sequence ) ;
auto first_3 = sp_dyn . first < 3 > ( ) ;
auto first_4 = sp_nine . first < 4 > ( ) ;
auto first_5 = sp_dyn . first ( 5 ) ;
auto first_6 = sp_nine . first ( 6 ) ;
static_assert ( noexcept ( sp_dyn . first < 3 > ( ) ) , " noexcept(sp_dyn.first<3>()) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . first < 4 > ( ) ) , " noexcept(sp_nine.first<4>()) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . first ( 5 ) ) , " noexcept(sp_dyn.first(5)) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . first ( 6 ) ) , " noexcept(sp_nine.first(6)) " ) ; // strengthened
static_assert ( is_same < decltype ( first_3 ) , gsl : : span < int , 3 > > : : value ,
" is_same<decltype(first_3), gsl::span<int, 3>>::value " ) ;
static_assert ( is_same < decltype ( first_4 ) , gsl : : span < int , 4 > > : : value ,
" is_same<decltype(first_4), gsl::span<int, 4>>::value " ) ;
static_assert ( is_same < decltype ( first_5 ) , gsl : : span < int > > : : value ,
" is_same<decltype(first_5), gsl::span<int>>::value " ) ;
static_assert ( is_same < decltype ( first_6 ) , gsl : : span < int > > : : value ,
" is_same<decltype(first_6), gsl::span<int>>::value " ) ;
EXPECT_TRUE ( first_3 . data ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( first_4 . data ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( first_5 . data ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( first_6 . data ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( first_3 . size ( ) = = 3 ) ;
EXPECT_TRUE ( first_4 . size ( ) = = 4 ) ;
EXPECT_TRUE ( first_5 . size ( ) = = 5 ) ;
EXPECT_TRUE ( first_6 . size ( ) = = 6 ) ;
auto last_3 = sp_dyn . last < 3 > ( ) ;
auto last_4 = sp_nine . last < 4 > ( ) ;
auto last_5 = sp_dyn . last ( 5 ) ;
auto last_6 = sp_nine . last ( 6 ) ;
static_assert ( noexcept ( sp_dyn . last < 3 > ( ) ) , " noexcept(sp_dyn.last<3>()) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . last < 4 > ( ) ) , " noexcept(sp_nine.last<4>()) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . last ( 5 ) ) , " noexcept(sp_dyn.last(5)) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . last ( 6 ) ) , " noexcept(sp_nine.last(6)) " ) ; // strengthened
static_assert ( is_same < decltype ( last_3 ) , gsl : : span < int , 3 > > : : value ,
" is_same<decltype(last_3), gsl::span<int, 3>>::value " ) ;
static_assert ( is_same < decltype ( last_4 ) , gsl : : span < int , 4 > > : : value ,
" is_same<decltype(last_4), gsl::span<int, 4>>::value " ) ;
static_assert ( is_same < decltype ( last_5 ) , gsl : : span < int > > : : value ,
" is_same<decltype(last_5), gsl::span<int>>::value " ) ;
static_assert ( is_same < decltype ( last_6 ) , gsl : : span < int > > : : value ,
" is_same<decltype(last_6), gsl::span<int>>::value " ) ;
EXPECT_TRUE ( last_3 . data ( ) = = std : : begin ( sequence ) + 6 ) ;
EXPECT_TRUE ( last_4 . data ( ) = = std : : begin ( sequence ) + 5 ) ;
EXPECT_TRUE ( last_5 . data ( ) = = std : : begin ( sequence ) + 4 ) ;
EXPECT_TRUE ( last_6 . data ( ) = = std : : begin ( sequence ) + 3 ) ;
EXPECT_TRUE ( last_3 . size ( ) = = 3 ) ;
EXPECT_TRUE ( last_4 . size ( ) = = 4 ) ;
EXPECT_TRUE ( last_5 . size ( ) = = 5 ) ;
EXPECT_TRUE ( last_6 . size ( ) = = 6 ) ;
auto offset_3 = sp_dyn . subspan < 3 > ( ) ;
auto offset_4 = sp_nine . subspan < 4 > ( ) ;
auto offset_5 = sp_dyn . subspan ( 5 ) ;
auto offset_6 = sp_nine . subspan ( 6 ) ;
static_assert ( noexcept ( sp_dyn . subspan < 3 > ( ) ) ,
" noexcept(sp_dyn.subspan<3>()) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . subspan < 4 > ( ) ) ,
" noexcept(sp_nine.subspan<4>()) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . subspan ( 5 ) ) , " noexcept(sp_dyn.subspan(5)) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . subspan ( 6 ) ) , " noexcept(sp_nine.subspan(6)) " ) ; // strengthened
static_assert ( is_same < decltype ( offset_3 ) , gsl : : span < int > > : : value ,
" is_same<decltype(offset_3), gsl::span<int>>::value " ) ;
static_assert ( is_same < decltype ( offset_4 ) , gsl : : span < int , 5 > > : : value ,
" is_same<decltype(offset_4), gsl::span<int, 5>>::value " ) ;
static_assert ( is_same < decltype ( offset_5 ) , gsl : : span < int > > : : value ,
" is_same<decltype(offset_5), gsl::span<int>>::value " ) ;
static_assert ( is_same < decltype ( offset_6 ) , gsl : : span < int > > : : value ,
" is_same<decltype(offset_6), gsl::span<int>>::value " ) ;
EXPECT_TRUE ( offset_3 . data ( ) = = std : : begin ( sequence ) + 3 ) ;
EXPECT_TRUE ( offset_4 . data ( ) = = std : : begin ( sequence ) + 4 ) ;
EXPECT_TRUE ( offset_5 . data ( ) = = std : : begin ( sequence ) + 5 ) ;
EXPECT_TRUE ( offset_6 . data ( ) = = std : : begin ( sequence ) + 6 ) ;
EXPECT_TRUE ( offset_3 . size ( ) = = 6 ) ;
EXPECT_TRUE ( offset_4 . size ( ) = = 5 ) ;
EXPECT_TRUE ( offset_5 . size ( ) = = 4 ) ;
EXPECT_TRUE ( offset_6 . size ( ) = = 3 ) ;
auto subspan_3 = sp_dyn . subspan < 3 , 2 > ( ) ;
auto subspan_4 = sp_nine . subspan < 4 , 2 > ( ) ;
auto subspan_5 = sp_dyn . subspan ( 5 , 2 ) ;
auto subspan_6 = sp_nine . subspan ( 6 , 2 ) ;
static_assert ( noexcept ( sp_dyn . subspan < 3 , 2 > ( ) ) ,
" noexcept(sp_dyn.subspan<3, 2>()) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . subspan < 4 , 2 > ( ) ) ,
" noexcept(sp_nine.subspan<4, 2>()) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . subspan ( 5 , 2 ) ) ,
" noexcept(sp_dyn.subspan(5, 2)) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . subspan ( 6 , 2 ) ) ,
" noexcept(sp_nine.subspan(6, 2)) " ) ; // strengthened
static_assert ( is_same < decltype ( subspan_3 ) , gsl : : span < int , 2 > > : : value ,
" is_same<decltype(subspan_3), gsl::span<int, 2>>::value " ) ;
static_assert ( is_same < decltype ( subspan_4 ) , gsl : : span < int , 2 > > : : value ,
" is_same<decltype(subspan_4), gsl::span<int, 2>>::value " ) ;
static_assert ( is_same < decltype ( subspan_5 ) , gsl : : span < int > > : : value ,
" is_same<decltype(subspan_5), gsl::span<int>>::value " ) ;
static_assert ( is_same < decltype ( subspan_6 ) , gsl : : span < int > > : : value ,
" is_same<decltype(subspan_6), gsl::span<int>>::value " ) ;
EXPECT_TRUE ( subspan_3 . data ( ) = = std : : begin ( sequence ) + 3 ) ;
EXPECT_TRUE ( subspan_4 . data ( ) = = std : : begin ( sequence ) + 4 ) ;
EXPECT_TRUE ( subspan_5 . data ( ) = = std : : begin ( sequence ) + 5 ) ;
EXPECT_TRUE ( subspan_6 . data ( ) = = std : : begin ( sequence ) + 6 ) ;
EXPECT_TRUE ( subspan_3 . size ( ) = = 2 ) ;
EXPECT_TRUE ( subspan_4 . size ( ) = = 2 ) ;
EXPECT_TRUE ( subspan_5 . size ( ) = = 2 ) ;
EXPECT_TRUE ( subspan_6 . size ( ) = = 2 ) ;
static_assert ( noexcept ( sp_dyn . size ( ) ) , " noexcept(sp_dyn.size()) " ) ;
static_assert ( noexcept ( sp_dyn . size_bytes ( ) ) , " noexcept(sp_dyn.size_bytes()) " ) ;
static_assert ( noexcept ( sp_dyn . empty ( ) ) , " noexcept(sp_dyn.empty()) " ) ;
static_assert ( noexcept ( sp_dyn [ 0 ] ) , " noexcept(sp_dyn[0]) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . front ( ) ) , " noexcept(sp_dyn.front()) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . back ( ) ) , " noexcept(sp_dyn.back()) " ) ; // strengthened
static_assert ( noexcept ( sp_dyn . data ( ) ) , " noexcept(sp_dyn.data()) " ) ;
static_assert ( noexcept ( sp_dyn . begin ( ) ) , " noexcept(sp_dyn.begin()) " ) ;
static_assert ( noexcept ( sp_dyn . end ( ) ) , " noexcept(sp_dyn.end()) " ) ;
static_assert ( noexcept ( sp_dyn . cbegin ( ) ) , " noexcept(sp_dyn.cbegin()) " ) ;
static_assert ( noexcept ( sp_dyn . cend ( ) ) , " noexcept(sp_dyn.cend()) " ) ;
static_assert ( noexcept ( sp_dyn . rbegin ( ) ) , " noexcept(sp_dyn.rbegin()) " ) ;
static_assert ( noexcept ( sp_dyn . rend ( ) ) , " noexcept(sp_dyn.rend()) " ) ;
static_assert ( noexcept ( sp_dyn . crbegin ( ) ) , " noexcept(sp_dyn.crbegin()) " ) ;
static_assert ( noexcept ( sp_dyn . crend ( ) ) , " noexcept(sp_dyn.crend()) " ) ;
static_assert ( noexcept ( sp_nine . size ( ) ) , " noexcept(sp_nine.size()) " ) ;
static_assert ( noexcept ( sp_nine . size_bytes ( ) ) , " noexcept(sp_nine.size_bytes()) " ) ;
static_assert ( noexcept ( sp_nine . empty ( ) ) , " noexcept(sp_nine.empty()) " ) ;
static_assert ( noexcept ( sp_nine [ 0 ] ) , " noexcept(sp_nine[0]) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . front ( ) ) , " noexcept(sp_nine.front()) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . back ( ) ) , " noexcept(sp_nine.back()) " ) ; // strengthened
static_assert ( noexcept ( sp_nine . data ( ) ) , " noexcept(sp_nine.data()) " ) ;
static_assert ( noexcept ( sp_nine . begin ( ) ) , " noexcept(sp_nine.begin()) " ) ;
static_assert ( noexcept ( sp_nine . end ( ) ) , " noexcept(sp_nine.end()) " ) ;
static_assert ( noexcept ( sp_nine . cbegin ( ) ) , " noexcept(sp_nine.cbegin()) " ) ;
static_assert ( noexcept ( sp_nine . cend ( ) ) , " noexcept(sp_nine.cend()) " ) ;
static_assert ( noexcept ( sp_nine . rbegin ( ) ) , " noexcept(sp_nine.rbegin()) " ) ;
static_assert ( noexcept ( sp_nine . rend ( ) ) , " noexcept(sp_nine.rend()) " ) ;
static_assert ( noexcept ( sp_nine . crbegin ( ) ) , " noexcept(sp_nine.crbegin()) " ) ;
static_assert ( noexcept ( sp_nine . crend ( ) ) , " noexcept(sp_nine.crend()) " ) ;
EXPECT_TRUE ( sp_dyn . size ( ) = = 9 ) ;
EXPECT_TRUE ( sp_nine . size ( ) = = 9 ) ;
EXPECT_TRUE ( sp_dyn . size_bytes ( ) = = 9 * sizeof ( int ) ) ;
EXPECT_TRUE ( sp_nine . size_bytes ( ) = = 9 * sizeof ( int ) ) ;
EXPECT_TRUE ( ! sp_dyn . empty ( ) ) ;
EXPECT_TRUE ( ! sp_nine . empty ( ) ) ;
EXPECT_TRUE ( sp_dyn [ 0 ] = = 10 ) ;
EXPECT_TRUE ( sp_nine [ 0 ] = = 10 ) ;
EXPECT_TRUE ( sp_dyn [ 8 ] = = 90 ) ;
EXPECT_TRUE ( sp_nine [ 8 ] = = 90 ) ;
EXPECT_TRUE ( sp_dyn . front ( ) = = 10 ) ;
EXPECT_TRUE ( sp_nine . front ( ) = = 10 ) ;
EXPECT_TRUE ( sp_dyn . back ( ) = = 90 ) ;
EXPECT_TRUE ( sp_nine . back ( ) = = 90 ) ;
EXPECT_TRUE ( & sp_dyn . front ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( & sp_nine . front ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( & sp_dyn [ 4 ] = = std : : begin ( sequence ) + 4 ) ;
EXPECT_TRUE ( & sp_nine [ 4 ] = = std : : begin ( sequence ) + 4 ) ;
EXPECT_TRUE ( & sp_dyn . back ( ) = = std : : begin ( sequence ) + 8 ) ;
EXPECT_TRUE ( & sp_nine . back ( ) = = std : : begin ( sequence ) + 8 ) ;
EXPECT_TRUE ( sp_dyn . data ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( sp_nine . data ( ) = = std : : begin ( sequence ) ) ;
EXPECT_TRUE ( * sp_dyn . begin ( ) = = 10 ) ;
EXPECT_TRUE ( * sp_nine . begin ( ) = = 10 ) ;
EXPECT_TRUE ( sp_dyn . end ( ) [ - 2 ] = = 80 ) ;
EXPECT_TRUE ( sp_nine . end ( ) [ - 2 ] = = 80 ) ;
EXPECT_TRUE ( * sp_dyn . cbegin ( ) = = 10 ) ;
EXPECT_TRUE ( * sp_nine . cbegin ( ) = = 10 ) ;
EXPECT_TRUE ( sp_dyn . cend ( ) [ - 2 ] = = 80 ) ;
EXPECT_TRUE ( sp_nine . cend ( ) [ - 2 ] = = 80 ) ;
EXPECT_TRUE ( * sp_dyn . rbegin ( ) = = 90 ) ;
EXPECT_TRUE ( * sp_nine . rbegin ( ) = = 90 ) ;
EXPECT_TRUE ( sp_dyn . rend ( ) [ - 2 ] = = 20 ) ;
EXPECT_TRUE ( sp_nine . rend ( ) [ - 2 ] = = 20 ) ;
EXPECT_TRUE ( * sp_dyn . crbegin ( ) = = 90 ) ;
EXPECT_TRUE ( * sp_nine . crbegin ( ) = = 90 ) ;
EXPECT_TRUE ( sp_dyn . crend ( ) [ - 2 ] = = 20 ) ;
EXPECT_TRUE ( sp_nine . crend ( ) [ - 2 ] = = 20 ) ;
static_assert ( is_same < decltype ( sp_dyn . begin ( ) ) , gsl : : span < int > : : iterator > : : value ,
" is_same<decltype(sp_dyn.begin()), gsl::span<int>::iterator>::value " ) ;
static_assert ( is_same < decltype ( sp_nine . begin ( ) ) , gsl : : span < int , 9 > : : iterator > : : value ,
" is_same<decltype(sp_nine.begin()), gsl::span<int, 9>::iterator>::value " ) ;
static_assert ( is_same < decltype ( sp_dyn . end ( ) ) , gsl : : span < int > : : iterator > : : value ,
" is_same<decltype(sp_dyn.end()), gsl::span<int>::iterator>::value " ) ;
static_assert ( is_same < decltype ( sp_nine . end ( ) ) , gsl : : span < int , 9 > : : iterator > : : value ,
" is_same<decltype(sp_nine.end()), gsl::span<int, 9>::iterator>::value " ) ;
static_assert ( is_same < decltype ( sp_dyn . cbegin ( ) ) , gsl : : span < int > : : const_iterator > : : value ,
" is_same<decltype(sp_dyn.cbegin()), gsl::span<int>::const_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_nine . cbegin ( ) ) , gsl : : span < int , 9 > : : const_iterator > : : value ,
" is_same<decltype(sp_nine.cbegin()), gsl::span<int, 9>::const_iterator>::value " ) ;
static_assert ( is_same < decltype ( sp_dyn . cend ( ) ) , gsl : : span < int > : : const_iterator > : : value ,
" is_same<decltype(sp_dyn.cend()), gsl::span<int>::const_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_nine . cend ( ) ) , gsl : : span < int , 9 > : : const_iterator > : : value ,
" is_same<decltype(sp_nine.cend()), gsl::span<int, 9>::const_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_dyn . rbegin ( ) ) , gsl : : span < int > : : reverse_iterator > : : value ,
" is_same<decltype(sp_dyn.rbegin()), gsl::span<int>::reverse_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_nine . rbegin ( ) ) , gsl : : span < int , 9 > : : reverse_iterator > : : value ,
" is_same<decltype(sp_nine.rbegin()), gsl::span<int, 9>::reverse_iterator>::value " ) ;
static_assert ( is_same < decltype ( sp_dyn . rend ( ) ) , gsl : : span < int > : : reverse_iterator > : : value ,
" is_same<decltype(sp_dyn.rend()), gsl::span<int>::reverse_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_nine . rend ( ) ) , gsl : : span < int , 9 > : : reverse_iterator > : : value ,
" is_same<decltype(sp_nine.rend()), gsl::span<int, 9>::reverse_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_dyn . crbegin ( ) ) , gsl : : span < int > : : const_reverse_iterator > : : value ,
" is_same<decltype(sp_dyn.crbegin()), gsl::span<int>::const_reverse_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_nine . crbegin ( ) ) , gsl : : span < int , 9 > : : const_reverse_iterator > : : value ,
" is_same<decltype(sp_nine.crbegin()), gsl::span<int, "
" 9>::const_reverse_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_dyn . crend ( ) ) , gsl : : span < int > : : const_reverse_iterator > : : value ,
" is_same<decltype(sp_dyn.crend()), gsl::span<int>::const_reverse_iterator>::value " ) ;
static_assert (
is_same < decltype ( sp_nine . crend ( ) ) , gsl : : span < int , 9 > : : const_reverse_iterator > : : value ,
" is_same<decltype(sp_nine.crend()), gsl::span<int, 9>::const_reverse_iterator>::value " ) ;
}
{
int sequence [ 9 ] { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 } ;
constexpr size_t SizeBytes = sizeof ( sequence ) ;
const gsl : : span < int > sp_dyn ( sequence ) ;
const gsl : : span < int , 9 > sp_nine ( sequence ) ;
const gsl : : span < const int > sp_const_dyn ( sequence ) ;
const gsl : : span < const int , 9 > sp_const_nine ( sequence ) ;
static_assert ( noexcept ( as_bytes ( sp_dyn ) ) , " noexcept(as_bytes(sp_dyn)) " ) ;
static_assert ( noexcept ( as_bytes ( sp_nine ) ) , " noexcept(as_bytes(sp_nine)) " ) ;
static_assert ( noexcept ( as_bytes ( sp_const_dyn ) ) , " noexcept(as_bytes(sp_const_dyn)) " ) ;
static_assert ( noexcept ( as_bytes ( sp_const_nine ) ) , " noexcept(as_bytes(sp_const_nine)) " ) ;
static_assert ( noexcept ( as_writable_bytes ( sp_dyn ) ) , " noexcept(as_writable_bytes(sp_dyn)) " ) ;
static_assert ( noexcept ( as_writable_bytes ( sp_nine ) ) , " noexcept(as_writable_bytes(sp_nine)) " ) ;
auto sp_1 = as_bytes ( sp_dyn ) ;
auto sp_2 = as_bytes ( sp_nine ) ;
auto sp_3 = as_bytes ( sp_const_dyn ) ;
auto sp_4 = as_bytes ( sp_const_nine ) ;
auto sp_5 = as_writable_bytes ( sp_dyn ) ;
auto sp_6 = as_writable_bytes ( sp_nine ) ;
static_assert ( is_same < decltype ( sp_1 ) , gsl : : span < const byte > > : : value ,
" is_same<decltype(sp_1), gsl::span<const byte>>::value " ) ;
static_assert ( is_same < decltype ( sp_2 ) , gsl : : span < const byte , SizeBytes > > : : value ,
" is_same<decltype(sp_2), gsl::span<const byte, SizeBytes>>::value " ) ;
static_assert ( is_same < decltype ( sp_3 ) , gsl : : span < const byte > > : : value ,
" is_same<decltype(sp_3), gsl::span<const byte>>::value " ) ;
static_assert ( is_same < decltype ( sp_4 ) , gsl : : span < const byte , SizeBytes > > : : value ,
" is_same<decltype(sp_4), gsl::span<const byte, SizeBytes>>::value " ) ;
static_assert ( is_same < decltype ( sp_5 ) , gsl : : span < byte > > : : value ,
" is_same<decltype(sp_5), gsl::span<byte>>::value " ) ;
static_assert ( is_same < decltype ( sp_6 ) , gsl : : span < byte , SizeBytes > > : : value ,
" is_same<decltype(sp_6), gsl::span<byte, SizeBytes>>::value " ) ;
EXPECT_TRUE ( sp_1 . data ( ) = = reinterpret_cast < const byte * > ( begin ( sequence ) ) ) ;
EXPECT_TRUE ( sp_2 . data ( ) = = reinterpret_cast < const byte * > ( begin ( sequence ) ) ) ;
EXPECT_TRUE ( sp_3 . data ( ) = = reinterpret_cast < const byte * > ( begin ( sequence ) ) ) ;
EXPECT_TRUE ( sp_4 . data ( ) = = reinterpret_cast < const byte * > ( begin ( sequence ) ) ) ;
EXPECT_TRUE ( sp_5 . data ( ) = = reinterpret_cast < byte * > ( begin ( sequence ) ) ) ;
EXPECT_TRUE ( sp_6 . data ( ) = = reinterpret_cast < byte * > ( begin ( sequence ) ) ) ;
EXPECT_TRUE ( sp_1 . size ( ) = = SizeBytes ) ;
EXPECT_TRUE ( sp_2 . size ( ) = = SizeBytes ) ;
EXPECT_TRUE ( sp_3 . size ( ) = = SizeBytes ) ;
EXPECT_TRUE ( sp_4 . size ( ) = = SizeBytes ) ;
EXPECT_TRUE ( sp_5 . size ( ) = = SizeBytes ) ;
EXPECT_TRUE ( sp_6 . size ( ) = = SizeBytes ) ;
}
}
// assertions for span's definition
static_assert ( std : : is_same < decltype ( gsl : : dynamic_extent ) , const std : : size_t > : : value ,
" gsl::dynamic_extent must be respresented as std::size_t " ) ;
static_assert ( gsl : : dynamic_extent = = static_cast < std : : size_t > ( - 1 ) ,
" gsl::dynamic_extent must be defined as the max value of std::size_t " ) ;
static_assert ( std : : is_same < decltype ( gsl : : span < int > : : extent ) , const std : : size_t > : : value ,
" Ensure that the type of gsl::span::extent is std::size_t " ) ;
static_assert ( gsl : : span < int > : : extent = = gsl : : dynamic_extent ,
" gsl::span<int>::extent should be equivalent to gsl::dynamic_extent " ) ;
static_assert ( std : : is_same < decltype ( gsl : : span < int , 3 > : : extent ) , const std : : size_t > : : value ,
" Ensure that the type of gsl::span::extent is std::size_t " ) ;
static_assert ( gsl : : span < int , 3 > : : extent = = 3 , " Ensure that span<int, 3>::extent is equal to 3 " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : element_type , int > : : value ,
" span<int>::element_type should be int " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : value_type , int > : : value ,
" span<int>::value_type should be int " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : size_type , std : : size_t > : : value ,
" span<int>::size_type should be std::size_t " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : difference_type , ptrdiff_t > : : value ,
" span<int>::difference_type should be std::ptrdiff_t " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : pointer , int * > : : value ,
" span<int>::pointer should be int* " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : const_pointer , const int * > : : value ,
" span<int>::const_pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : reference , int & > : : value ,
" span<int>::reference should be int& " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : const_reference , const int & > : : value ,
" span<int>::const_reference should be const int& " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : element_type , int > : : value ,
" span<int, 3>::element_type should be int " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : value_type , int > : : value ,
" span<int, 3>::value_type should be int " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : size_type , std : : size_t > : : value ,
" span<int, 3>::size_type should be std::size_t " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : difference_type , ptrdiff_t > : : value ,
" span<int, 3>::difference_type should be std::ptrdiff_t " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : pointer , int * > : : value ,
" span<int, 3>::pointer should be int* " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : const_pointer , const int * > : : value ,
" span<int, 3>::const_pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : reference , int & > : : value ,
" span<int, 3>::reference should be int& " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : const_reference , const int & > : : value ,
" span<int, 3>::const_reference should be const int& " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : element_type , const int > : : value ,
" span<const int>::element_type should be const int " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : value_type , int > : : value ,
" span<const int>::value_type should be int " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : size_type , std : : size_t > : : value ,
" span<const int>::size_type should be size_t " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : difference_type , ptrdiff_t > : : value ,
" span<const int>::difference_type should be ptrdiff_t " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : pointer , const int * > : : value ,
" span<const int>::pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : const_pointer , const int * > : : value ,
" span<const int>::const_pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : reference , const int & > : : value ,
" span<const int>::reference should be const int& " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : const_reference , const int & > : : value ,
" span<const int>::const_reference should be const int& " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : element_type , const int > : : value ,
" span<const int, 3>::element_type should be const int " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : value_type , int > : : value ,
" span<const int, 3>::value_type should be int " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : size_type , std : : size_t > : : value ,
" span<const int, 3>::size_type should be size_t " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : difference_type , ptrdiff_t > : : value ,
" span<const int, 3>::difference_type should be ptrdiff_t " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : pointer , const int * > : : value ,
" span<const int, 3>::pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : const_pointer , const int * > : : value ,
" span<const int, 3>::const_pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : reference , const int & > : : value ,
" span<const int, 3>::reference should be const int& " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : const_reference , const int & > : : value ,
" span<const int, 3>::const_reference should be const int& " ) ;
// assertions for span_iterator
static_assert ( std : : is_same < std : : iterator_traits < gsl : : span < int > : : iterator > : : pointer , int * > : : value ,
" span<int>::iterator's pointer should be int* " ) ;
static_assert (
std : : is_same < std : : iterator_traits < gsl : : span < int > : : const_iterator > : : pointer , const int * > : : value ,
" span<int>::const_iterator's pointer should be const int* " ) ;
static_assert (
std : : is_same < gsl : : span < int > : : reverse_iterator ,
std : : reverse_iterator < gsl : : span < int > : : iterator > > : : value ,
" span<int>::reverse_iterator should equal std::reverse_iterator<span<int>::iterator> " ) ;
static_assert ( std : : is_same < gsl : : span < int > : : const_reverse_iterator ,
std : : reverse_iterator < gsl : : span < int > : : const_iterator > > : : value ,
" span<int>::const_reverse_iterator should equal "
" std::reverse_iterator<span<int>::const_iterator> " ) ;
static_assert ( std : : is_same < std : : iterator_traits < gsl : : span < int , 3 > : : iterator > : : pointer , int * > : : value ,
" span<int, 3>::iterator's pointer should be int* " ) ;
static_assert ( std : : is_same < std : : iterator_traits < gsl : : span < int , 3 > : : const_iterator > : : pointer ,
const int * > : : value ,
" span<int, 3>::const_iterator's pointer should be const int* " ) ;
static_assert (
std : : is_same < gsl : : span < int , 3 > : : reverse_iterator ,
std : : reverse_iterator < gsl : : span < int , 3 > : : iterator > > : : value ,
" span<int, 3>::reverse_iterator should equal std::reverse_iterator<span<int, 3>::iterator> " ) ;
static_assert ( std : : is_same < gsl : : span < int , 3 > : : const_reverse_iterator ,
std : : reverse_iterator < gsl : : span < int , 3 > : : const_iterator > > : : value ,
" span<int, 3>::const_reverse_iterator should equal std::reverse_iterator<span<int, "
" 3>::const_iterator> " ) ;
static_assert (
std : : is_same < std : : iterator_traits < gsl : : span < const int > : : iterator > : : pointer , const int * > : : value ,
" span<const int>::iterator's pointer should be int* " ) ;
static_assert ( std : : is_same < std : : iterator_traits < gsl : : span < const int > : : const_iterator > : : pointer ,
const int * > : : value ,
" span<const int>::const_iterator's pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : reverse_iterator ,
std : : reverse_iterator < gsl : : span < const int > : : iterator > > : : value ,
" span<const int>::reverse_iterator should equal std::reverse_iterator<span<const "
" int>::iterator> " ) ;
static_assert ( std : : is_same < gsl : : span < const int > : : const_reverse_iterator ,
std : : reverse_iterator < gsl : : span < const int > : : const_iterator > > : : value ,
" span<const int>::const_reverse_iterator should equal "
" std::reverse_iterator<span<const int>::const_iterator> " ) ;
static_assert ( std : : is_same < std : : iterator_traits < gsl : : span < const int , 3 > : : iterator > : : pointer ,
const int * > : : value ,
" span<const int, 3>::iterator's pointer should be int* " ) ;
static_assert ( std : : is_same < std : : iterator_traits < gsl : : span < const int , 3 > : : const_iterator > : : pointer ,
const int * > : : value ,
" span<const int, 3>::const_iterator's pointer should be const int* " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : reverse_iterator ,
std : : reverse_iterator < gsl : : span < const int , 3 > : : iterator > > : : value ,
" span<const int, 3>::reverse_iterator should equal std::reverse_iterator<span<const "
" int, 3>::iterator> " ) ;
static_assert ( std : : is_same < gsl : : span < const int , 3 > : : const_reverse_iterator ,
std : : reverse_iterator < gsl : : span < const int , 3 > : : const_iterator > > : : value ,
" span<const int, 3>::const_reverse_iterator should equal "
" std::reverse_iterator<span<const int, 3>::const_iterator> " ) ;
// copyability assertions
static_assert ( std : : is_trivially_copyable < gsl : : span < int > > : : value ,
" span<int> should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < int > : : iterator > : : value ,
" span<int>::iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < int > : : const_iterator > : : value ,
" span<int>::const_iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < int , 3 > > : : value ,
" span<int, 3> should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < int , 3 > : : iterator > : : value ,
" span<int, 3>::iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < int , 3 > : : const_iterator > : : value ,
" span<int, 3>::const_iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < const int > > : : value ,
" span<const int> should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < const int > : : iterator > : : value ,
" span<const int>::iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < const int > : : const_iterator > : : value ,
" span<const int>::const_iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < const int , 3 > > : : value ,
" span<const int, 3> should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < const int , 3 > : : iterator > : : value ,
" span<const int, 3>::iterator should be trivially copyable " ) ;
static_assert ( std : : is_trivially_copyable < gsl : : span < const int , 3 > : : const_iterator > : : value ,
" span<const int, 3>::const_iterator should be trivially copyable " ) ;
// nothrow constructible assertions
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , int * , std : : size_t > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, int*, std::size_t> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , int * , std : : uint16_t > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, int*, std::uint16_t> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , int * , int * > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, int*, int*> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , int ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, int(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , const gsl : : span < int > & > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , const gsl : : span < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , const gsl : : span < int , 500 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int, 500>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int > , std : : array < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<int>, std::array<int, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int , 3 > , int * , std : : size_t > : : value ,
" std::is_nothrow_constructible<gsl::span<int, 3>, int*, std::size_t> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int , 3 > , int * , std : : uint16_t > : : value ,
" std::is_nothrow_constructible<gsl::span<int, 3>, int*, std::uint16_t> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int , 3 > , int * , int * > : : value ,
" std::is_nothrow_constructible<gsl::span<int, 3>, int*, int*> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int , 3 > , int ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<int, 3>, int(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int , 3 > , const gsl : : span < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<int, 3>, const gsl::span<int, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < int , 3 > , std : : array < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<int, 3>, std::array<int, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , int * , std : : size_t > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, int*, std::size_t> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , int * , int * > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, int*, int*> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , int * , const int * > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, int*, const int*> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , int ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, int(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const int * , int * > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const int*, int*> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const int * , const int * > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const int*, const int*> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const int * , std : : size_t > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const int*, std::size_t> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const int ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const int(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const gsl : : span < int > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const gsl : : span < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const int > , const gsl : : span < int , 500 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int, 500>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const int > , const gsl : : span < const int > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const int > , const gsl : : span < const int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const int > , const gsl : : span < const int , 500 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int, 500>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , std : : array < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, std::array<int, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const int > , const std : : array < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int>, const std::array<int, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const int , 3 > , const gsl : : span < int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int, 3>, const gsl::span<int, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const int , 3 > , const gsl : : span < const int , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const int, 3>, const gsl::span<const int, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base > , Base ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<Base>, Base(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base > , const gsl : : span < Base > & > : : value ,
" std::is_nothrow_constructible<gsl::span<Base>, const gsl::span<Base>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base > , const gsl : : span < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<Base>, const gsl::span<Base, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base > , std : : array < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<Base>, std::array<Base, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base , 3 > , Base ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<Base, 3>, Base(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base , 3 > , const gsl : : span < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<Base, 3>, const gsl::span<Base, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < Base , 3 > , std : : array < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<Base, 3>, std::array<Base, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const Base > , Base ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, Base(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const Base > , const Base ( & ) [ 3 ] > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, const Base(&)[3]> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const Base > , const gsl : : span < Base > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<Base>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const Base > , const gsl : : span < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<Base, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const Base > , const gsl : : span < const Base > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<const Base>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const Base > , const gsl : : span < const Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<const Base, 3>&> " ) ;
static_assert ( std : : is_nothrow_constructible < gsl : : span < const Base > , std : : array < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, std::array<Base, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const Base > , const std : : array < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base>, const std::array<Base, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const Base , 3 > , const gsl : : span < Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base, 3>, const gsl::span<Base, 3>&> " ) ;
static_assert (
std : : is_nothrow_constructible < gsl : : span < const Base , 3 > , const gsl : : span < const Base , 3 > & > : : value ,
" std::is_nothrow_constructible<gsl::span<const Base, 3>, const gsl::span<const Base, 3>&> " ) ;
// non-constructible assertions
static_assert ( ! std : : is_constructible < gsl : : span < int > , const int * , int * > : : value ,
" !std::is_constructible<gsl::span<int>, const int*, int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const int * , const int * > : : value ,
" !std::is_constructible<gsl::span<int>, const int*, const int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const int * , double * > : : value ,
" !std::is_constructible<gsl::span<int>, const int*, double*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const int * , std : : size_t > : : value ,
" !std::is_constructible<gsl::span<int>, const int*, std::size_t> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const int ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<int>, const int(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , double * , int * > : : value ,
" !std::is_constructible<gsl::span<int>, double*, int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , double * , const int * > : : value ,
" !std::is_constructible<gsl::span<int>, double*, const int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , double * , double * > : : value ,
" !std::is_constructible<gsl::span<int>, double*, double*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , double * , std : : size_t > : : value ,
" !std::is_constructible<gsl::span<int>, double*, std::size_t> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , double ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<int>, double(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , int * , double * > : : value ,
" !std::is_constructible<gsl::span<int>, int*, double*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , std : : size_t , int * > : : value ,
" !std::is_constructible<gsl::span<int>, std::size_t, int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , std : : size_t , std : : size_t > : : value ,
" !std::is_constructible<gsl::span<int>, std::size_t, std::size_t> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const gsl : : span < const int > & > : : value ,
" !std::is_constructible<gsl::span<int>, const gsl::span<const int>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const gsl : : span < const int , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int>, const gsl::span<const int, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const gsl : : span < const int , 500 > & > : : value ,
" !std::is_constructible<gsl::span<int>, const gsl::span<const int, 500>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const gsl : : span < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int>, const gsl::span<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , std : : array < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int>, std::array<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int > , const std : : array < int , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int>, const std::array<int, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , int * , double * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, int*, double*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , int ( & ) [ 500 ] > : : value ,
" !std::is_constructible<gsl::span<int, 3>, int(&)[500]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const int * , int * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const int*, int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const int * , const int * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const int*, const int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const int * , std : : size_t > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const int*, std::size_t> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const int * , double * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const int*, double*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const int ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const int(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , double * , std : : size_t > : : value ,
" !std::is_constructible<gsl::span<int, 3>, double*, std::size_t> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , double * , int * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, double*, int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , double * , const int * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, double*, const int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , double * , double * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, double*, double*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , double ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<int, 3>, double(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , std : : size_t , int * > : : value ,
" !std::is_constructible<gsl::span<int, 3>, std::size_t, int*> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , std : : size_t , std : : size_t > : : value ,
" !std::is_constructible<gsl::span<int, 3>, std::size_t, std::size_t> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , std : : array < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, std::array<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , std : : array < int , 500 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, std::array<int, 500>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const std : : array < int , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const std::array<int, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const gsl : : span < int > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const gsl : : span < int , 500 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const gsl::span<int, 500>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const gsl : : span < const int > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const gsl::span<const int>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const gsl : : span < const int , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const gsl::span<const int, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const gsl : : span < const int , 500 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const gsl::span<const int, 500>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < int , 3 > , const gsl : : span < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<int, 3>, const gsl::span<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int > , double ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<const int>, double(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int > , std : : array < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const int>, std::array<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int > , const gsl : : span < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const int>, const gsl::span<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int , 3 > , const gsl : : span < int > & > : : value ,
" !std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int , 3 > , const gsl : : span < int , 500 > & > : : value ,
" !std::is_constructible<gsl::span<const int, 3>, const gsl::span<int, 500>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int , 3 > , const gsl : : span < const int > & > : : value ,
" !std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&> " ) ;
static_assert (
! std : : is_constructible < gsl : : span < const int , 3 > , const gsl : : span < const int , 500 > & > : : value ,
" !std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int, 500>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const int , 3 > , const gsl : : span < double , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const int, 3>, const gsl::span<double, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < Base > , Derived ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<Base>, Derived(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < Base > , std : : array < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<Base>, std::array<Derived, 3>&> " ) ;
2020-02-18 17:09:11 -05:00
static_assert ( ! std : : is_constructible < gsl : : span < Base > , std : : vector < Derived > & > : : value ,
" !std::is_constructible<gsl::span<Base>, std::vector<Derived>&> " ) ;
2020-02-14 18:24:46 -05:00
static_assert ( ! std : : is_constructible < gsl : : span < Base > , const gsl : : span < Derived > & > : : value ,
" !std::is_constructible<gsl::span<Base>, const gsl::span<Derived>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < Base > , const gsl : : span < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<Base>, const gsl::span<Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < Base , 3 > , const gsl : : span < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<Base, 3>, const gsl::span<Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < Base , 3 > , Derived ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<Base, 3>, Derived(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < Base , 3 > , std : : array < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<Base, 3>, std::array<Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , Derived ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<const Base>, Derived(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , const Derived ( & ) [ 3 ] > : : value ,
" !std::is_constructible<gsl::span<const Base>, const Derived(&)[3]> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , std : : array < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Base>, std::array<Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , const std : : array < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Base>, const std::array<Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , const gsl : : span < Derived > & > : : value ,
" !std::is_constructible<gsl::span<const Base>, const gsl::span<Derived>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , const gsl : : span < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Base>, const gsl::span<Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base > , const gsl : : span < const Derived > & > : : value ,
" !std::is_constructible<gsl::span<const Base>, const gsl::span<const Derived>&> " ) ;
static_assert (
! std : : is_constructible < gsl : : span < const Base > , const gsl : : span < const Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Base>, const gsl::span<const Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Base , 3 > , const gsl : : span < Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Base, 3>, const gsl::span<Derived, 3>&> " ) ;
static_assert (
! std : : is_constructible < gsl : : span < const Base , 3 > , const gsl : : span < const Derived , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Base, 3>, const gsl::span<const Derived, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Derived > , std : : array < Base , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Derived>, std::array<Base, 3>&> " ) ;
static_assert ( ! std : : is_constructible < gsl : : span < const Derived > , const std : : array < Base , 3 > & > : : value ,
" !std::is_constructible<gsl::span<const Derived>, const std::array<Base, 3>&> " ) ;
// no throw copy constructor
static_assert ( std : : is_nothrow_copy_constructible < gsl : : span < int > > : : value ,
" std::is_nothrow_copy_constructible<gsl::span<int>> " ) ;
static_assert ( std : : is_nothrow_copy_constructible < gsl : : span < int , 3 > > : : value ,
" std::is_nothrow_copy_constructible<gsl::span<int, 3>> " ) ;
static_assert ( std : : is_nothrow_copy_constructible < gsl : : span < const int > > : : value ,
" std::is_nothrow_copy_constructible<gsl::span<const int>> " ) ;
static_assert ( std : : is_nothrow_copy_constructible < gsl : : span < const int , 3 > > : : value ,
" std::is_nothrow_copy_constructible<gsl::span<const int, 3>> " ) ;
// no throw copy assignment
static_assert ( std : : is_nothrow_copy_assignable < gsl : : span < int > > : : value ,
" std::is_nothrow_copy_assignable<gsl::span<int>> " ) ;
static_assert ( std : : is_nothrow_copy_assignable < gsl : : span < int , 3 > > : : value ,
" std::is_nothrow_copy_assignable<gsl::span<int, 3>> " ) ;
static_assert ( std : : is_nothrow_copy_assignable < gsl : : span < const int > > : : value ,
" std::is_nothrow_copy_assignable<gsl::span<const int>> " ) ;
static_assert ( std : : is_nothrow_copy_assignable < gsl : : span < const int , 3 > > : : value ,
" std::is_nothrow_copy_assignable<gsl::span<const int, 3>> " ) ;
// no throw destruction
static_assert ( std : : is_nothrow_destructible < gsl : : span < int > > : : value ,
" std::is_nothrow_destructible<gsl::span<int>> " ) ;
static_assert ( std : : is_nothrow_destructible < gsl : : span < int , 3 > > : : value ,
" std::is_nothrow_destructible<gsl::span<int, 3>> " ) ;
static_assert ( std : : is_nothrow_destructible < gsl : : span < const int > > : : value ,
" std::is_nothrow_destructible<gsl::span<const int>> " ) ;
// conversions
static_assert ( std : : is_convertible < int ( & ) [ 3 ] , gsl : : span < int > > : : value ,
" std::is_convertible<int(&)[3], gsl::span<int>> " ) ;
static_assert ( std : : is_convertible < int ( & ) [ 3 ] , gsl : : span < int , 3 > > : : value ,
" std::is_convertible<int(&)[3], gsl::span<int, 3>> " ) ;
static_assert ( std : : is_convertible < int ( & ) [ 3 ] , gsl : : span < const int > > : : value ,
" std::is_convertible<int(&)[3], gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const int ( & ) [ 3 ] , gsl : : span < const int > > : : value ,
" std::is_convertible<const int(&)[3], gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int > & , gsl : : span < int > > : : value ,
" std::is_convertible<const gsl::span<int>&, gsl::span<int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const gsl::span<int>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int , 3 > & , gsl : : span < int > > : : value ,
" std::is_convertible<const gsl::span<int, 3>&, gsl::span<int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int , 3 > & , gsl : : span < int , 3 > > : : value ,
" std::is_convertible<const gsl::span<int, 3>&, gsl::span<int, 3>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int , 3 > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const gsl::span<int, 3>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int , 3 > & , gsl : : span < const int , 3 > > : : value ,
" std::is_convertible<const gsl::span<int, 3>&, gsl::span<const int, 3>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int , 500 > & , gsl : : span < int > > : : value ,
" std::is_convertible<const gsl::span<int, 500>&, gsl::span<int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < int , 500 > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const gsl::span<int, 500>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < const int > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const gsl::span<const int>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < const int , 3 > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const gsl::span<const int, 3>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < const int , 3 > & , gsl : : span < const int , 3 > > : : value ,
" std::is_convertible<const gsl::span<const int, 3>&, gsl::span<const int, 3>> " ) ;
static_assert ( std : : is_convertible < const gsl : : span < const int , 500 > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const gsl::span<const int, 500>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < std : : array < int , 3 > & , gsl : : span < int > > : : value ,
" std::is_convertible<std::array<int, 3>&, gsl::span<int>> " ) ;
static_assert ( std : : is_convertible < std : : array < int , 3 > & , gsl : : span < int , 3 > > : : value ,
" std::is_convertible<std::array<int, 3>&, gsl::span<int, 3>> " ) ;
static_assert ( std : : is_convertible < std : : array < int , 3 > & , gsl : : span < const int > > : : value ,
" std::is_convertible<std::array<int, 3>&, gsl::span<const int>> " ) ;
static_assert ( std : : is_convertible < const std : : array < int , 3 > & , gsl : : span < const int > > : : value ,
" std::is_convertible<const std::array<int, 3>&, gsl::span<const int>> " ) ;
2020-02-18 17:09:11 -05:00
2020-02-14 19:25:25 -05:00
# if __cplusplus >= 201703l
template < typename U , typename = void >
2020-02-18 17:09:11 -05:00
static constexpr bool AsWritableBytesCompilesFor = false ;
2020-02-14 19:25:25 -05:00
template < typename U >
2020-03-17 18:04:58 -04:00
static constexpr bool
AsWritableBytesCompilesFor < U , void_t < decltype ( as_writable_bytes ( declval < U > ( ) ) ) > > = true ;
2020-02-18 17:09:11 -05:00
2020-02-14 19:25:25 -05:00
static_assert ( AsWritableBytesCompilesFor < gsl : : span < int > > ,
2020-03-17 18:04:58 -04:00
" AsWritableBytesCompilesFor<gsl::span<int>> " ) ;
2020-02-14 19:25:25 -05:00
static_assert ( AsWritableBytesCompilesFor < gsl : : span < int , 9 > > ,
2020-03-17 18:04:58 -04:00
" AsWritableBytesCompilesFor<gsl::span<int, 9>> " ) ;
2020-02-14 19:25:25 -05:00
static_assert ( ! AsWritableBytesCompilesFor < gsl : : span < const int > > ,
2020-03-17 18:04:58 -04:00
" !AsWritableBytesCompilesFor<gsl::span<const int>> " ) ;
2020-02-14 19:25:25 -05:00
static_assert ( ! AsWritableBytesCompilesFor < gsl : : span < const int , 9 > > ,
2020-03-17 18:04:58 -04:00
" !AsWritableBytesCompilesFor<gsl::span<const int, 9>> " ) ;
2020-02-14 19:25:25 -05:00
# endif // __cplusplus >= 201703l