mirror of
https://github.com/boostorg/variant2.git
synced 2025-07-29 19:57:18 +02:00
Split variant_index_type into separate runs for each variant size
This commit is contained in:
11
test/Jamfile
11
test/Jamfile
@ -144,9 +144,16 @@ compile variant_visit_cx.cpp : [ requires cxx14_constexpr ] ;
|
||||
compile variant_visit_cx_2.cpp : [ requires cxx14_constexpr ] ;
|
||||
compile variant_visit_r_cx.cpp : [ requires cxx14_constexpr ] ;
|
||||
|
||||
run variant_index_type.cpp : : :
|
||||
local index-type-reqs =
|
||||
|
||||
<variant>release
|
||||
<toolset>msvc,<address-model>32:<build>no
|
||||
<toolset>msvc-14.0:<build>no # fails on GHA (only) with "out of heap space"
|
||||
<toolset>clang,<target-os>linux:<cxxflags>-ftemplate-depth=1024 # for Clang 3.x
|
||||
;
|
||||
|
||||
local list-sizes = 126 127 128 129 254 255 256 257 ;
|
||||
|
||||
for local list-size in $(list-sizes)
|
||||
{
|
||||
run variant_index_type.cpp : : : $(index-type-reqs) <define>LIST_SIZE=$(list-size) : variant_index_type_$(list-size) ;
|
||||
}
|
||||
|
@ -43,9 +43,11 @@ template<std::size_t I> struct W
|
||||
|
||||
template<class N> using Wf = W< N::value >;
|
||||
|
||||
template<template<class...> class F, std::size_t N> void test_()
|
||||
template<class L, template<class...> class F> void test()
|
||||
{
|
||||
using V = mp_rename< mp_transform<F, mp_iota_c<N>>, boost::variant2::variant >;
|
||||
using V = mp_rename< mp_transform<F, L>, boost::variant2::variant >;
|
||||
|
||||
constexpr std::size_t N = mp_size<L>::value;
|
||||
|
||||
using last_type = F<mp_size_t<N-1>>;
|
||||
|
||||
@ -63,32 +65,22 @@ template<template<class...> class F, std::size_t N> void test_()
|
||||
}
|
||||
}
|
||||
|
||||
template<template<class...> class F> void test()
|
||||
{
|
||||
test_<F, 126>();
|
||||
test_<F, 127>();
|
||||
test_<F, 128>();
|
||||
test_<F, 129>();
|
||||
|
||||
test_<F, 254>();
|
||||
test_<F, 255>();
|
||||
test_<F, 256>();
|
||||
test_<F, 257>();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
constexpr std::size_t N = LIST_SIZE;
|
||||
using L = mp_iota_c<N>;
|
||||
|
||||
static_assert( !boost::variant2::variant< X<0>, X<1> >::uses_double_storage(), "" );
|
||||
test<Xf>();
|
||||
test<L, Xf>();
|
||||
|
||||
static_assert( boost::variant2::variant< Y<0>, Y<1> >::uses_double_storage(), "" );
|
||||
test<Yf>();
|
||||
test<L, Yf>();
|
||||
|
||||
static_assert( !boost::variant2::variant< Z<0>, Z<1> >::uses_double_storage(), "" );
|
||||
test<Zf>();
|
||||
test<L, Zf>();
|
||||
|
||||
static_assert( boost::variant2::variant< W<0>, W<1> >::uses_double_storage(), "" );
|
||||
test<Wf>();
|
||||
test<L, Wf>();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user