Remove BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT

This commit is contained in:
Christian Mazakas
2023-08-29 12:39:51 -07:00
parent f088a5b9b9
commit 8782036a88
8 changed files with 33 additions and 104 deletions

View File

@ -14,52 +14,7 @@
#include <boost/predef.h>
#if defined(BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT)
// Already defined.
#elif defined(BOOST_LIBSTDCXX11)
// https://github.com/gcc-mirror/gcc/blob/gcc-4_6-branch/libstdc++-v3/include/bits/stl_pair.h#L70
#if BOOST_LIBSTDCXX_VERSION > 40600
#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1
#endif
#elif BOOST_LIB_STD_CXX
// https://github.com/llvm-mirror/libcxx/blob/release_30/include/utility#L206
#if BOOST_LIB_STD_CXX >= BOOST_VERSION_NUMBER(3, 0, 0)
#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1
#endif
#elif defined(BOOST_LIB_STD_DINKUMWARE)
// Apparently C++11 standard supported in Visual Studio 2012
// https://msdn.microsoft.com/en-us/library/hh567368.aspx#stl
// 2012 = VC+11 = BOOST_MSVC 1700 Hopefully!
// I have no idea when Dinkumware added it, probably a lot
// earlier than this check.
#if BOOST_LIB_STD_DINKUMWARE >= BOOST_VERSION_NUMBER(6, 10, 0) || \
BOOST_COMP_MSVC >= BOOST_VERSION_NUMBER(17, 0, 0)
#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1
#endif
#endif
// Assume that an unknown library does not support piecewise construction.
#if !defined(BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT)
#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 0
#endif
#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT
#include <utility>
#endif
namespace boost {
namespace unordered {
#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT
using std::piecewise_construct_t;
using std::piecewise_construct;
#else
struct piecewise_construct_t
{
};
const piecewise_construct_t piecewise_construct = piecewise_construct_t();
#endif
}
}
// BOOST_UNORDERED_EMPLACE_LIMIT = The maximum number of parameters in
// emplace (not including things like hints). Don't set it to a lower value, as

View File

@ -646,7 +646,7 @@ namespace boost {
template <typename A0> struct use_piecewise
{
static choice1::type test(
choice1, boost::unordered::piecewise_construct_t);
choice1, std::piecewise_construct_t);
static choice2::type test(choice2, ...);
@ -3080,7 +3080,7 @@ namespace boost {
#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
template <typename T2> \
static no_key extract(boost::unordered::piecewise_construct_t, \
static no_key extract(std::piecewise_construct_t, \
namespace_ tuple<> const&, T2 const&) \
{ \
return no_key(); \
@ -3088,7 +3088,7 @@ namespace boost {
\
template <typename T, typename T2> \
static typename is_key<key_type, T>::type extract( \
boost::unordered::piecewise_construct_t, namespace_ tuple<T> const& k, \
std::piecewise_construct_t, namespace_ tuple<T> const& k, \
T2 const&) \
{ \
return typename is_key<key_type, T>::type(namespace_ get<0>(k)); \
@ -3098,14 +3098,14 @@ namespace boost {
#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
static no_key extract( \
boost::unordered::piecewise_construct_t, namespace_ tuple<> const&) \
std::piecewise_construct_t, namespace_ tuple<> const&) \
{ \
return no_key(); \
} \
\
template <typename T> \
static typename is_key<key_type, T>::type extract( \
boost::unordered::piecewise_construct_t, namespace_ tuple<T> const& k) \
std::piecewise_construct_t, namespace_ tuple<T> const& k) \
{ \
return typename is_key<key_type, T>::type(namespace_ get<0>(k)); \
}

View File

@ -292,7 +292,7 @@ struct pair_emplace_type : inserter_base
x.emplace(std::piecewise_construct, std::make_tuple(it->first),
std::make_tuple(it->second));
#else
x.emplace(boost::unordered::piecewise_construct,
x.emplace(std::piecewise_construct,
boost::make_tuple(it->first), boost::make_tuple(it->second));
#endif
}
@ -307,7 +307,7 @@ struct pair_emplace2_type : inserter_base
std::make_tuple(it->first),
std::make_tuple(it->second.tag1_, it->second.tag2_));
#else
x.emplace_hint(x.begin(), boost::unordered::piecewise_construct,
x.emplace_hint(x.begin(), std::piecewise_construct,
boost::make_tuple(it->first),
boost::make_tuple(it->second.tag1_, it->second.tag2_));
#endif

View File

@ -134,8 +134,6 @@ namespace test {
<< "Compiler: " << BOOST_COMPILER << "\n" \
<< "Library: " << BOOST_STDLIB << "\n" \
<< "__cplusplus: " << BOOST_UNORDERED_CPLUSPLUS << "\n\n" \
<< "BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT: " \
<< BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT << "\n" \
<< "BOOST_UNORDERED_EMPLACE_LIMIT: " << BOOST_UNORDERED_EMPLACE_LIMIT \
<< "\n" \
<< std::flush; \

View File

@ -451,7 +451,7 @@ void unordered_map_test(X& r, Key const& k, T const& v)
#ifdef BOOST_UNORDERED_FOA_TESTS
r.emplace(std::piecewise_construct, std::make_tuple(k), std::make_tuple(v));
#else
r.emplace(boost::unordered::piecewise_construct, boost::make_tuple(k),
r.emplace(std::piecewise_construct, boost::make_tuple(k),
boost::make_tuple(v));
#endif
@ -465,7 +465,7 @@ void unordered_map_test(X& r, Key const& k, T const& v)
r.emplace_hint(r.begin(), std::piecewise_construct, std::make_tuple(k),
std::make_tuple(v));
#else
r.emplace_hint(r.begin(), boost::unordered::piecewise_construct,
r.emplace_hint(r.begin(), std::piecewise_construct,
boost::make_tuple(k), boost::make_tuple(v));
#endif

View File

@ -453,7 +453,7 @@ namespace emplace_tests {
// 5/8 args + duplicate
emplace_value k1(5, "", 'b', 4, 5);
emplace_value m1(8, "xxx", 'z', 4, 5, 6, 7, 8);
r1 = x.emplace(boost::unordered::piecewise_construct,
r1 = x.emplace(std::piecewise_construct,
boost::make_tuple(5, "", 'b', 4, 5),
boost::make_tuple(8, "xxx", 'z', 4, 5, 6, 7, 8));
BOOST_TEST_EQ(x.size(), 1u);
@ -463,7 +463,7 @@ namespace emplace_tests {
BOOST_TEST_EQ(check_.instances(), 4);
BOOST_TEST_EQ(check_.constructions(), 4);
r2 = x.emplace(boost::unordered::piecewise_construct,
r2 = x.emplace(std::piecewise_construct,
boost::make_tuple(5, "", 'b', 4, 5),
boost::make_tuple(8, "xxx", 'z', 4, 5, 6, 7, 8));
BOOST_TEST_EQ(x.size(), 1u);
@ -479,7 +479,7 @@ namespace emplace_tests {
emplace_value k2(9, "", 'b', 4, 5, 6, 7, 8, 9);
emplace_value m2(3, "aaa", 'm');
r1 = x.emplace(boost::unordered::piecewise_construct,
r1 = x.emplace(std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(3, "aaa", 'm'));
BOOST_TEST_EQ(x.size(), 2u);
@ -492,15 +492,15 @@ namespace emplace_tests {
BOOST_TEST_EQ(check_.constructions(), 10);
BOOST_TEST(r1.first == x.emplace_hint(r1.first,
boost::unordered::piecewise_construct,
std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(15, "jkjk")));
BOOST_TEST(r1.first == x.emplace_hint(r2.first,
boost::unordered::piecewise_construct,
std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(275, "xxx", 'm', 6)));
BOOST_TEST(
r1.first == x.emplace_hint(x.end(), boost::unordered::piecewise_construct,
r1.first == x.emplace_hint(x.end(), std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(-10, "blah blah", '\0')));
BOOST_TEST_EQ(x.size(), 2u);
@ -540,7 +540,7 @@ namespace emplace_tests {
emplace_value k1(5, "", 'b', 4, 5);
emplace_value m1(8, "xxx", 'z', 4, 5, 6, 7, 8);
i1 = x.emplace(boost::unordered::piecewise_construct,
i1 = x.emplace(std::piecewise_construct,
boost::make_tuple(5, "", 'b', 4, 5),
boost::make_tuple(8, "xxx", 'z', 4, 5, 6, 7, 8));
BOOST_TEST_EQ(x.size(), 1u);
@ -550,7 +550,7 @@ namespace emplace_tests {
BOOST_TEST_EQ(check_.constructions(), 4);
emplace_value m1a(8, "xxx", 'z', 4, 5, 6, 7, 8);
i2 = x.emplace(boost::unordered::piecewise_construct,
i2 = x.emplace(std::piecewise_construct,
boost::make_tuple(5, "", 'b', 4, 5),
boost::make_tuple(8, "xxx", 'z', 4, 5, 6, 7, 8));
BOOST_TEST_EQ(x.size(), 2u);
@ -564,7 +564,7 @@ namespace emplace_tests {
emplace_value k2(9, "", 'b', 4, 5, 6, 7, 8, 9);
emplace_value m2(3, "aaa", 'm');
i1 = x.emplace(boost::unordered::piecewise_construct,
i1 = x.emplace(std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(3, "aaa", 'm'));
BOOST_TEST_EQ(x.size(), 3u);
@ -574,15 +574,15 @@ namespace emplace_tests {
BOOST_TEST_EQ(check_.constructions(), 11);
emplace_value m2a(15, "jkjk");
i2 = x.emplace_hint(i2, boost::unordered::piecewise_construct,
i2 = x.emplace_hint(i2, std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(15, "jkjk"));
emplace_value m2b(275, "xxx", 'm', 6);
i3 = x.emplace_hint(i1, boost::unordered::piecewise_construct,
i3 = x.emplace_hint(i1, std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(275, "xxx", 'm', 6));
emplace_value m2c(-10, "blah blah", '\0');
i4 = x.emplace_hint(x.end(), boost::unordered::piecewise_construct,
i4 = x.emplace_hint(x.end(), std::piecewise_construct,
boost::make_tuple(9, "", 'b', 4, 5, 6, 7, 8, 9),
boost::make_tuple(-10, "blah blah", '\0'));
BOOST_TEST_EQ(x.size(), 6u);

View File

@ -1331,7 +1331,7 @@ namespace insert_tests {
#endif
struct derived_from_piecewise_construct_t
: boost::unordered::piecewise_construct_t
: std::piecewise_construct_t
{
};
@ -1342,9 +1342,9 @@ namespace insert_tests {
struct convertible_to_piecewise
{
operator boost::unordered::piecewise_construct_t() const
operator std::piecewise_construct_t() const
{
return boost::unordered::piecewise_construct;
return std::piecewise_construct;
}
};
@ -1362,7 +1362,7 @@ namespace insert_tests {
std::pair<overloaded_constructor const, overloaded_constructor> > >
x;
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
x.emplace(std::piecewise_construct, boost::make_tuple(),
boost::make_tuple());
BOOST_TEST(
x.find(overloaded_constructor()) != x.end() &&
@ -1429,7 +1429,7 @@ namespace insert_tests {
std::pair<overloaded_constructor const, overloaded_constructor> > >
x;
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
x.emplace(std::piecewise_construct, boost::make_tuple(),
boost::make_tuple());
BOOST_TEST(
x.find(overloaded_constructor()) != x.end() &&
@ -1461,12 +1461,12 @@ namespace insert_tests {
x;
std::pair<overloaded_constructor, overloaded_constructor> check;
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
x.emplace(std::piecewise_construct, boost::make_tuple(),
boost::make_tuple());
BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check);
x.clear();
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(1),
x.emplace(std::piecewise_construct, boost::make_tuple(1),
boost::make_tuple(2, 3));
check =
std::make_pair(overloaded_constructor(1), overloaded_constructor(2, 3));
@ -1487,13 +1487,6 @@ namespace insert_tests {
static boost::unordered_set<std::pair<overloaded_constructor,
overloaded_constructor> >* test_pair_oc_set;
#define PIECEWISE_TEST_NAME boost_tuple_piecewise_tests
#define PIECEWISE_NAMESPACE boost::unordered
#define TUPLE_NAMESPACE boost
#define EMULATING_PIECEWISE_CONSTRUCTION 1
#include "./insert_tests.cpp"
#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT
#define PIECEWISE_TEST_NAME boost_tuple_std_piecewise_tests
#define PIECEWISE_NAMESPACE std
@ -1503,21 +1496,6 @@ namespace insert_tests {
#endif
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
#define PIECEWISE_TEST_NAME std_tuple_boost_piecewise_tests
#define PIECEWISE_NAMESPACE boost::unordered
#define TUPLE_NAMESPACE std
#define EMULATING_PIECEWISE_CONSTRUCTION 0
#include "./insert_tests.cpp"
#endif
#endif
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT
#ifdef BOOST_UNORDERED_FOA_TESTS
static boost::unordered_flat_set<std::pair<overloaded_constructor,
overloaded_constructor> >* test_pair_oc_set;
@ -1531,8 +1509,6 @@ namespace insert_tests {
#define TUPLE_NAMESPACE std
#define EMULATING_PIECEWISE_CONSTRUCTION 0
#include "./insert_tests.cpp"
#endif
}
RUN_TESTS_QUIET()

View File

@ -469,7 +469,7 @@ namespace unnecessary_copy_tests {
#endif
reset();
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
x.emplace(std::piecewise_construct, boost::make_tuple(),
boost::make_tuple());
COPY_COUNT(2);
MOVE_COUNT(0);
@ -536,7 +536,7 @@ namespace unnecessary_copy_tests {
MOVE_COUNT(0);
reset();
x.emplace(boost::unordered::piecewise_construct,
x.emplace(std::piecewise_construct,
boost::make_tuple(boost::ref(b.first)),
boost::make_tuple(boost::ref(b.second)));
COPY_COUNT(0);
@ -545,7 +545,7 @@ namespace unnecessary_copy_tests {
#if BOOST_UNORDERED_TUPLE_ARGS
reset();
x.emplace(boost::unordered::piecewise_construct,
x.emplace(std::piecewise_construct,
std::make_tuple(std::ref(b.first)), std::make_tuple(std::ref(b.second)));
COPY_COUNT(0);
MOVE_COUNT(0);
@ -559,7 +559,7 @@ namespace unnecessary_copy_tests {
std::pair<count_copies const, count_copies> move_source;
reset();
x.emplace(boost::unordered::piecewise_construct,
x.emplace(std::piecewise_construct,
std::make_tuple(std::move(move_source.first)),
std::make_tuple(std::move(move_source.second)));
COPY_COUNT(tuple_copy_cost);
@ -569,7 +569,7 @@ namespace unnecessary_copy_tests {
!(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6) && \
!(defined(BOOST_MSVC) && BOOST_MSVC < 1700)
reset();
x.emplace(boost::unordered::piecewise_construct,
x.emplace(std::piecewise_construct,
std::forward_as_tuple(b.first), std::forward_as_tuple(b.second));
COPY_COUNT(0);
MOVE_COUNT(0);