mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2024-11-12 21:09:01 +00:00
fix hash test
This commit is contained in:
parent
5df05cf750
commit
9140b68379
11 changed files with 157 additions and 48 deletions
|
@ -90,33 +90,33 @@ namespace testspr {
|
|||
}
|
||||
|
||||
// assign
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(arr1.assign(-1), array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(arr1.assign(-1), sprout::array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
{
|
||||
auto arr = arr1;
|
||||
arr.assign(-1);
|
||||
TESTSPR_ASSERT(testspr::equal(arr, array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
TESTSPR_ASSERT(testspr::equal(arr, sprout::array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
}
|
||||
|
||||
// fill
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(arr1.fill(-1), array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(arr1.fill(-1), sprout::array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
{
|
||||
auto arr = arr1;
|
||||
arr.fill(-1);
|
||||
TESTSPR_ASSERT(testspr::equal(arr, array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
TESTSPR_ASSERT(testspr::equal(arr, sprout::array<int, 10>{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}));
|
||||
}
|
||||
|
||||
// swap
|
||||
{
|
||||
auto arr1 = array<int, 2>{{1, 2}};
|
||||
auto arr2 = array<int, 2>{{-1, -2}};
|
||||
auto arr1 = sprout::array<int, 2>{{1, 2}};
|
||||
auto arr2 = sprout::array<int, 2>{{-1, -2}};
|
||||
arr1.swap(arr2);
|
||||
TESTSPR_ASSERT(arr1[0] == -1);
|
||||
}
|
||||
|
||||
// operator=
|
||||
{
|
||||
auto arr1 = array<int, 2>{{1, 2}};
|
||||
arr1 = array<int, 2>{{-1, -2}};
|
||||
auto arr1 = sprout::array<int, 2>{{1, 2}};
|
||||
arr1 = sprout::array<int, 2>{{-1, -2}};
|
||||
TESTSPR_ASSERT(arr1[0] == -1);
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,30 @@ namespace testspr {
|
|||
|
||||
// operator>=
|
||||
TESTSPR_BOTH_ASSERT(arr1 >= arr2);
|
||||
|
||||
// get
|
||||
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(arr1) == 1);
|
||||
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(arr1) == 2);
|
||||
{
|
||||
auto arr4 = arr1;
|
||||
TESTSPR_ASSERT(sprout::tuples::get<0>(arr4) == 1);
|
||||
TESTSPR_ASSERT(sprout::tuples::get<1>(arr4) == 2);
|
||||
}
|
||||
|
||||
// tuple_size
|
||||
TESTSPR_BOTH_ASSERT(sprout::tuples::tuple_size<decltype(arr1)>::value == 10);
|
||||
|
||||
// tuple_element
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<sprout::tuples::tuple_element<0, decltype(arr1)>::type, int const>::value));
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<sprout::tuples::tuple_element<1, decltype(arr1)>::type, int const>::value));
|
||||
|
||||
// is_array
|
||||
TESTSPR_BOTH_ASSERT(sprout::is_array<decltype(arr1)>::value);
|
||||
TESTSPR_BOTH_ASSERT(!sprout::is_array<int>::value);
|
||||
|
||||
// sprout::to_hash, sprout::hash
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(arr1) == sprout::hash<decltype(arr1)>()(arr1));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(arr1) != sprout::to_hash(sprout::array<int, 10>{{}}));
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
|
@ -196,7 +196,8 @@ namespace testspr {
|
|||
// 20.5.3 hash support
|
||||
|
||||
// sprout::to_hash, sprout::hash
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(bits1) == sprout::hash<bitset_t>()(bits1));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(bits1) == sprout::hash<decltype(bits1)>()(bits1));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(bits1) != sprout::to_hash(bitset_t()));
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
|
@ -337,6 +337,10 @@ namespace testspr {
|
|||
int v = 12345;
|
||||
TESTSPR_ASSERT(sprout::get_optional_value_or(opt3, v) == 12345);
|
||||
}
|
||||
|
||||
// sprout::to_hash, sprout::hash
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(opt1) == sprout::hash<decltype(opt1)>()(opt1));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(opt1) != sprout::to_hash(opt2));
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace testspr {
|
|||
using namespace sprout;
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR char cstr[] = "foobar1234";
|
||||
SPROUT_STATIC_CONSTEXPR auto str1 = to_string(cstr);
|
||||
SPROUT_STATIC_CONSTEXPR auto str2 = to_string("hogehoge");
|
||||
SPROUT_STATIC_CONSTEXPR auto str1 = sprout::to_string(cstr);
|
||||
SPROUT_STATIC_CONSTEXPR auto str2 = sprout::to_string("hogehoge");
|
||||
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<decltype(str1), sprout::basic_string<char, 10> const>::value));
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<decltype(str2), sprout::basic_string<char, 8> const>::value));
|
||||
|
@ -73,39 +73,39 @@ namespace testspr {
|
|||
|
||||
// swap
|
||||
{
|
||||
auto s1 = to_string("abc");
|
||||
auto s2 = to_string("ABC");
|
||||
auto s1 = sprout::to_string("abc");
|
||||
auto s2 = sprout::to_string("ABC");
|
||||
s1.swap(s2);
|
||||
TESTSPR_ASSERT(s1[0] == 'A');
|
||||
}
|
||||
|
||||
// assign
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
s.assign(to_string("ABC"));
|
||||
auto s = sprout::to_string("abc");
|
||||
s.assign(sprout::to_string("ABC"));
|
||||
TESTSPR_ASSERT(s.size() == 3);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
}
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
s.assign(to_string("ABC"), 0, 2);
|
||||
auto s = sprout::to_string("abc");
|
||||
s.assign(sprout::to_string("ABC"), 0, 2);
|
||||
TESTSPR_ASSERT(s.size() == 2);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
}
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
auto s = sprout::to_string("abc");
|
||||
s.assign("ABC", 2);
|
||||
TESTSPR_ASSERT(s.size() == 2);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
}
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
auto s = sprout::to_string("abc");
|
||||
s.assign("ABC");
|
||||
TESTSPR_ASSERT(s.size() == 3);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
}
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
auto s = sprout::to_string("abc");
|
||||
s.assign(1, 'A');
|
||||
TESTSPR_ASSERT(s.size() == 1);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
|
@ -113,19 +113,19 @@ namespace testspr {
|
|||
|
||||
// operator=
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
s = to_string("ABC");
|
||||
auto s = sprout::to_string("abc");
|
||||
s = sprout::to_string("ABC");
|
||||
TESTSPR_ASSERT(s.size() == 3);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
}
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
auto s = sprout::to_string("abc");
|
||||
s = "ABC";
|
||||
TESTSPR_ASSERT(s.size() == 3);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
}
|
||||
{
|
||||
auto s = to_string("abc");
|
||||
auto s = sprout::to_string("abc");
|
||||
s = 'A';
|
||||
TESTSPR_ASSERT(s.size() == 1);
|
||||
TESTSPR_ASSERT(s[0] == 'A');
|
||||
|
@ -133,7 +133,7 @@ namespace testspr {
|
|||
|
||||
// find
|
||||
TESTSPR_BOTH_ASSERT(str1.find(str2) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find(to_string("bar")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find(sprout::to_string("bar")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find(str2.c_str()) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find("bar") == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find(str2.c_str(), 0, 3) == npos);
|
||||
|
@ -142,7 +142,7 @@ namespace testspr {
|
|||
|
||||
// rfind
|
||||
TESTSPR_BOTH_ASSERT(str1.rfind(str2) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.rfind(to_string("bar")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.rfind(sprout::to_string("bar")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.rfind(str2.c_str()) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.rfind("bar") == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.rfind(str2.c_str(), npos, 3) == npos);
|
||||
|
@ -150,8 +150,8 @@ namespace testspr {
|
|||
TESTSPR_BOTH_ASSERT(str1.rfind('b') == 3);
|
||||
|
||||
// find_first_of
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of(to_string("vwxyz")) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of(to_string("rab")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of(sprout::to_string("vwxyz")) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of(sprout::to_string("rab")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of("vwxyz") == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of("rab") == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_of("vwxyz", 0, 3) == npos);
|
||||
|
@ -159,8 +159,8 @@ namespace testspr {
|
|||
TESTSPR_BOTH_ASSERT(str1.find_first_of('b') == 3);
|
||||
|
||||
// find_last_of
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of(to_string("vwxyz")) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of(to_string("rab")) == 5);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of(sprout::to_string("vwxyz")) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of(sprout::to_string("rab")) == 5);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of("vwxyz") == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of("rab") == 5);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_of("vwxyz", npos, 3) == npos);
|
||||
|
@ -169,7 +169,7 @@ namespace testspr {
|
|||
|
||||
// find_first_not_of
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_not_of(to_string("foo")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_not_of(sprout::to_string("foo")) == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1.c_str()) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_not_of("foo") == 3);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1.c_str(), 0, 10) == npos);
|
||||
|
@ -178,7 +178,7 @@ namespace testspr {
|
|||
|
||||
// find_last_not_of
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_not_of(to_string("4321")) == 5);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_not_of(sprout::to_string("4321")) == 5);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1.c_str()) == npos);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_not_of("4321") == 5);
|
||||
TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1.c_str(), npos, 10) == npos);
|
||||
|
@ -201,14 +201,14 @@ namespace testspr {
|
|||
|
||||
// compare
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(str1) == 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(to_string("zzzz")) < 0);
|
||||
TESTSPR_BOTH_ASSERT(str2.compare(to_string("aaaa")) > 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, to_string("foo")) == 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, to_string("zzzz")) < 0);
|
||||
TESTSPR_BOTH_ASSERT(str2.compare(0, 3, to_string("aaaa")) > 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, to_string("foo"), 0, 3) == 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, to_string("zzzz"), 0, 3) < 0);
|
||||
TESTSPR_BOTH_ASSERT(str2.compare(0, 3, to_string("aaaa"), 0, 3) > 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(sprout::to_string("zzzz")) < 0);
|
||||
TESTSPR_BOTH_ASSERT(str2.compare(sprout::to_string("aaaa")) > 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, sprout::to_string("foo")) == 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, sprout::to_string("zzzz")) < 0);
|
||||
TESTSPR_BOTH_ASSERT(str2.compare(0, 3, sprout::to_string("aaaa")) > 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, sprout::to_string("foo"), 0, 3) == 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(0, 3, sprout::to_string("zzzz"), 0, 3) < 0);
|
||||
TESTSPR_BOTH_ASSERT(str2.compare(0, 3, sprout::to_string("aaaa"), 0, 3) > 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare(str1.c_str()) == 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare("zzzz") < 0);
|
||||
TESTSPR_BOTH_ASSERT(str1.compare("aaaa") > 0);
|
||||
|
@ -241,7 +241,7 @@ namespace testspr {
|
|||
{
|
||||
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
|
||||
// ! Error in GCC4.7
|
||||
SPROUT_STATIC_CONSTEXPR auto str3 = str1 + to_string("hogehoge");
|
||||
SPROUT_STATIC_CONSTEXPR auto str3 = str1 + sprout::to_string("hogehoge");
|
||||
TESTSPR_BOTH_ASSERT(str3 == "foobar1234hogehoge");
|
||||
#endif
|
||||
|
||||
|
@ -283,10 +283,34 @@ namespace testspr {
|
|||
|
||||
// operator basic_string
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR string_t<10>::type str3 = to_string("foobar");
|
||||
SPROUT_STATIC_CONSTEXPR string_t<10>::type str3 = sprout::to_string("foobar");
|
||||
TESTSPR_BOTH_ASSERT(str3 == "foobar");
|
||||
TESTSPR_BOTH_ASSERT(str3.size() == 6);
|
||||
}
|
||||
|
||||
// get
|
||||
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(str1) == 'f');
|
||||
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(str1) == 'o');
|
||||
{
|
||||
auto str3 = str1;
|
||||
TESTSPR_ASSERT(sprout::tuples::get<0>(str3) == 'f');
|
||||
TESTSPR_ASSERT(sprout::tuples::get<1>(str3) == 'o');
|
||||
}
|
||||
|
||||
// tuple_size
|
||||
TESTSPR_BOTH_ASSERT(sprout::tuples::tuple_size<decltype(str1)>::value == 10);
|
||||
|
||||
// tuple_element
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<sprout::tuples::tuple_element<0, decltype(str1)>::type, char const>::value));
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<sprout::tuples::tuple_element<1, decltype(str1)>::type, char const>::value));
|
||||
|
||||
// is_string
|
||||
TESTSPR_BOTH_ASSERT(sprout::is_string<decltype(str1)>::value);
|
||||
TESTSPR_BOTH_ASSERT(!sprout::is_string<int>::value);
|
||||
|
||||
// sprout::to_hash, sprout::hash
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(str1) == sprout::hash<decltype(str1)>()(str1));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(str1) != sprout::to_hash(str2));
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
|
@ -221,8 +221,12 @@ namespace testspr {
|
|||
TESTSPR_BOTH_ASSERT(sprout::tuples::is_tuple<decltype(tup1)>::value);
|
||||
TESTSPR_BOTH_ASSERT(!sprout::tuples::is_tuple<int>::value);
|
||||
|
||||
// hash_value
|
||||
TESTSPR_BOTH_ASSERT((hash_value(sprout::tuples::tuple<int, int>(1, 2)) != 0));
|
||||
// sprout::to_hash, sprout::hash
|
||||
{
|
||||
typedef sprout::tuples::tuple<int, int> type;
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(type(1, 2)) == sprout::hash<type>()(type(1, 2)));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(type(1, 2)) != sprout::to_hash(type()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
|
@ -213,6 +213,17 @@ namespace testspr {
|
|||
// tuple_element
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<sprout::tuples::tuple_element<0, decltype(var1)>::type, int const>::value));
|
||||
TESTSPR_BOTH_ASSERT((std::is_same<sprout::tuples::tuple_element<1, decltype(var1)>::type, double const>::value));
|
||||
|
||||
// is_variant
|
||||
TESTSPR_BOTH_ASSERT(sprout::is_variant<decltype(var1)>::value);
|
||||
TESTSPR_BOTH_ASSERT(!sprout::is_variant<int>::value);
|
||||
|
||||
// sprout::to_hash, sprout::hash
|
||||
{
|
||||
typedef sprout::variant<int, char> type;
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(type(1)) == sprout::hash<type>()(type(1)));
|
||||
TESTSPR_BOTH_ASSERT(sprout::to_hash(type(1)) != sprout::to_hash(type()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include <sprout/tuple/tuple/tuple.hpp>
|
||||
#include <sprout/tuple/tuple/comparison.hpp>
|
||||
#include <sprout/tuple/tuple/get.hpp>
|
||||
#include <sprout/tuple/tuple/hash.hpp>
|
||||
#include <sprout/tuple/tuple/ignore.hpp>
|
||||
#include <sprout/tuple/tuple/make_tuple.hpp>
|
||||
#include <sprout/tuple/tuple/type_traits.hpp>
|
||||
#include <sprout/tuple/tuple/hash.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_TUPLE_TUPLE_HPP
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
#define SPROUT_VARIANT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/variant/variant_fwd.hpp>
|
||||
#include <sprout/variant/variant.hpp>
|
||||
#include <sprout/variant/io.hpp>
|
||||
#include <sprout/variant/tuple.hpp>
|
||||
#include <sprout/variant/get.hpp>
|
||||
#include <sprout/variant/hash.hpp>
|
||||
#include <sprout/variant/type_traits.hpp>
|
||||
#include <sprout/variant/static_visitor.hpp>
|
||||
#include <sprout/variant/static_variant_visitor.hpp>
|
||||
#include <sprout/variant/as_visitor.hpp>
|
||||
|
|
30
sprout/variant/type_traits.hpp
Normal file
30
sprout/variant/type_traits.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef SPROUT_VARIANT_TYPE_TRAITS_HPP
|
||||
#define SPROUT_VARIANT_TYPE_TRAITS_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/variant/variant_fwd.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// is_variant
|
||||
//
|
||||
template<typename T>
|
||||
struct is_variant
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_variant<T const>
|
||||
: public sprout::is_variant<T>
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_variant<T const volatile>
|
||||
: public sprout::is_variant<T>
|
||||
{};
|
||||
template<typename... Types>
|
||||
struct is_variant<sprout::variant<Types...> >
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_VARIANT_TYPE_TRAITS_HPP
|
|
@ -16,12 +16,10 @@
|
|||
#include <sprout/type/algorithm/find_index.hpp>
|
||||
#include <sprout/functional/type_traits/has_type.hpp>
|
||||
#include <sprout/functional/type_traits/weak_result_type.hpp>
|
||||
#include <sprout/variant/variant_fwd.hpp>
|
||||
#include <sprout/variant/visitor_result.hpp>
|
||||
|
||||
namespace sprout {
|
||||
template<typename... Types>
|
||||
class variant;
|
||||
|
||||
namespace detail {
|
||||
template<typename... Types>
|
||||
class variant_impl {
|
||||
|
|
11
sprout/variant/variant_fwd.hpp
Normal file
11
sprout/variant/variant_fwd.hpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef SPROUT_VARIANT_VARIANT_FWD_HPP
|
||||
#define SPROUT_VARIANT_VARIANT_FWD_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
template<typename... Types>
|
||||
class variant;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_VARIANT_VARIANT_FWD_HPP
|
Loading…
Reference in a new issue