From 9c43ae36126b5902d6d47a81278edfd2a09630cd Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 23 Dec 2022 01:28:59 +0300 Subject: [PATCH] Use is_same from Boost.TypeTraits. boost::core::is_same is deprecated, so use the one from Boost.TypeTraits instead. --- test/optional_test_flat_map.cpp | 4 ++-- test/optional_test_make_optional.cpp | 28 ++++++++++++++-------------- test/optional_test_map.cpp | 26 +++++++++++++------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/test/optional_test_flat_map.cpp b/test/optional_test_flat_map.cpp index a6b2b13..05ed63a 100644 --- a/test/optional_test_flat_map.cpp +++ b/test/optional_test_flat_map.cpp @@ -16,14 +16,14 @@ #endif #include "boost/core/ignore_unused.hpp" -#include "boost/core/is_same.hpp" #include "boost/core/lightweight_test.hpp" #include "boost/core/lightweight_test_trait.hpp" +#include "boost/type_traits/is_same.hpp" using boost::optional; using boost::make_optional; -using boost::core::is_same; +using boost::is_same; template void verify_type(Deduced) diff --git a/test/optional_test_make_optional.cpp b/test/optional_test_make_optional.cpp index be271bd..f5ef23b 100644 --- a/test/optional_test_make_optional.cpp +++ b/test/optional_test_make_optional.cpp @@ -16,21 +16,21 @@ #endif #include "boost/core/ignore_unused.hpp" -#include "boost/core/is_same.hpp" #include "boost/core/lightweight_test.hpp" #include "boost/core/lightweight_test_trait.hpp" +#include "boost/type_traits/is_same.hpp" using boost::optional; using boost::make_optional; -using boost::core::is_same; +using boost::is_same; template void verify_type(Deduced) { BOOST_TEST_TRAIT_TRUE(( is_same )); } - + #if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) struct MoveOnly { @@ -38,7 +38,7 @@ struct MoveOnly explicit MoveOnly(int i) : value(i) {} MoveOnly(MoveOnly && r) : value(r.value) { r.value = 0; } MoveOnly& operator=(MoveOnly && r) { value = r.value; r.value = 0; return *this; } - + private: MoveOnly(MoveOnly const&); void operator=(MoveOnly const&); @@ -53,15 +53,15 @@ void test_make_optional_for_move_only_type() { verify_type< optional >(make_optional(makeMoveOnly(2))); verify_type< optional >(make_optional(true, makeMoveOnly(2))); - + optional o1 = make_optional(makeMoveOnly(1)); BOOST_TEST (o1); BOOST_TEST_EQ (1, o1->value); - + optional o2 = make_optional(true, makeMoveOnly(2)); BOOST_TEST (o2); BOOST_TEST_EQ (2, o2->value); - + optional oN = make_optional(false, makeMoveOnly(2)); BOOST_TEST (!oN); } @@ -73,15 +73,15 @@ void test_make_optional_for_optional() optional oi; verify_type< optional< optional > >(make_optional(oi)); verify_type< optional< optional > >(make_optional(true, oi)); - + optional< optional > ooi = make_optional(oi); BOOST_TEST (ooi); BOOST_TEST (!*ooi); - + optional< optional > ooT = make_optional(true, oi); BOOST_TEST (ooT); BOOST_TEST (!*ooT); - + optional< optional > ooF = make_optional(false, oi); BOOST_TEST (!ooF); } @@ -90,21 +90,21 @@ void test_nested_make_optional() { verify_type< optional< optional > >(make_optional(make_optional(1))); verify_type< optional< optional > >(make_optional(true, make_optional(true, 2))); - + optional< optional > oo1 = make_optional(make_optional(1)); BOOST_TEST (oo1); BOOST_TEST (*oo1); BOOST_TEST_EQ (1, **oo1); - + optional< optional > oo2 = make_optional(true, make_optional(true, 2)); BOOST_TEST (oo2); BOOST_TEST (*oo2); BOOST_TEST_EQ (2, **oo2); - + optional< optional > oo3 = make_optional(true, make_optional(false, 3)); BOOST_TEST (oo3); BOOST_TEST (!*oo3); - + optional< optional > oo4 = make_optional(false, make_optional(true, 4)); BOOST_TEST (!oo4); } diff --git a/test/optional_test_map.cpp b/test/optional_test_map.cpp index 3c1617b..f0b7f0e 100644 --- a/test/optional_test_map.cpp +++ b/test/optional_test_map.cpp @@ -16,29 +16,29 @@ #endif #include "boost/core/ignore_unused.hpp" -#include "boost/core/is_same.hpp" #include "boost/core/lightweight_test.hpp" #include "boost/core/lightweight_test_trait.hpp" +#include "boost/type_traits/is_same.hpp" using boost::optional; using boost::make_optional; -using boost::core::is_same; +using boost::is_same; template void verify_type(Deduced) { BOOST_TEST_TRAIT_TRUE(( is_same )); } - -#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) struct MoveOnly { int value; explicit MoveOnly(int i) : value(i) {} MoveOnly(MoveOnly && r) : value(r.value) { r.value = 0; } MoveOnly& operator=(MoveOnly && r) { value = r.value; r.value = 0; return *this; } - + private: MoveOnly(MoveOnly const&); void operator=(MoveOnly const&); @@ -70,7 +70,7 @@ void test_map_move_only() optional oj = makeOptMoveOnly(4).map(get_val); BOOST_TEST(bool(oj)); BOOST_TEST_EQ(4, *oj); - + optional o_; optional oi_ = boost::move(o_).map(get_val); BOOST_TEST(!oi_); @@ -126,16 +126,16 @@ void test_map_optional() optional o9 (9), o0 (0), o_; verify_type > >(o9.map(make_opt_int)); optional > oo9 = o9.map(make_opt_int); - BOOST_TEST(bool(oo9)); - BOOST_TEST(bool(*oo9)); + BOOST_TEST(bool(oo9)); + BOOST_TEST(bool(*oo9)); BOOST_TEST_EQ(9, (**oo9).i); optional > oo0 = o0.map(make_opt_int); - BOOST_TEST(bool(oo0)); - BOOST_TEST(!*oo0); - + BOOST_TEST(bool(oo0)); + BOOST_TEST(!*oo0); + optional > oo_ = o_.map(make_opt_int); - BOOST_TEST(!oo_); + BOOST_TEST(!oo_); } void test_map_with_lambda() @@ -178,7 +178,7 @@ void test_map_optional_ref() int main() { -#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) test_map_move_only(); #endif test_map_with_lambda();