mirror of
https://github.com/boostorg/functional.git
synced 2025-07-29 20:17:19 +02:00
Manually write out tuple overloads
A tad more usable this way.
This commit is contained in:
@ -18,4 +18,8 @@
|
||||
// before doing anything else.
|
||||
#pragma warning(disable:4201) // nonstandard extension used :
|
||||
// nameless struct/union
|
||||
|
||||
#endif
|
||||
|
||||
#define HASH_TEST_CAT(x, y) HASH_TEST_CAT2(x, y)
|
||||
#define HASH_TEST_CAT2(x, y) x##y
|
||||
|
@ -7,15 +7,13 @@
|
||||
#error "CONTAINER_TYPE not defined"
|
||||
#else
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244) // conversion from 'int' to 'float'
|
||||
#pragma warning(disable:4245) // signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
namespace HASH_TEST_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
template <class T>
|
||||
void integer_tests(T* = 0)
|
||||
@ -59,7 +57,7 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
}
|
||||
}
|
||||
|
||||
void BOOST_PP_CAT(CONTAINER_TYPE, _hash_integer_tests())
|
||||
void HASH_TEST_CAT(CONTAINER_TYPE, _hash_integer_tests())
|
||||
{
|
||||
integer_tests((CONTAINER_TYPE<char, unsigned char>*) 0);
|
||||
integer_tests((CONTAINER_TYPE<int, float>*) 0);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <iostream>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/functional/hash/detail/limits.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
|
||||
@ -140,7 +139,7 @@ void bool_test()
|
||||
{
|
||||
BOOST_HASH_TEST_NAMESPACE::hash<bool> x1;
|
||||
BOOST_HASH_TEST_NAMESPACE::hash<bool> x2;
|
||||
|
||||
|
||||
BOOST_TEST(x1(true) == x2(true));
|
||||
BOOST_TEST(x1(false) == x2(false));
|
||||
BOOST_TEST(x1(true) != x2(false));
|
||||
|
@ -7,14 +7,12 @@
|
||||
#error "CONTAINER_TYPE not defined"
|
||||
#else
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4245) // signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
namespace HASH_TEST_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
template <class T>
|
||||
void integer_tests(T* = 0)
|
||||
@ -61,7 +59,7 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
}
|
||||
}
|
||||
|
||||
void BOOST_PP_CAT(CONTAINER_TYPE, _hash_integer_tests())
|
||||
void HASH_TEST_CAT(CONTAINER_TYPE, _hash_integer_tests())
|
||||
{
|
||||
integer_tests((CONTAINER_TYPE<char>*) 0);
|
||||
integer_tests((CONTAINER_TYPE<int>*) 0);
|
||||
|
@ -7,14 +7,12 @@
|
||||
#error "CONTAINER_TYPE not defined"
|
||||
#else
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4245) // signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
namespace HASH_TEST_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
template <class T>
|
||||
void integer_tests(T* = 0)
|
||||
@ -64,7 +62,7 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
}
|
||||
}
|
||||
|
||||
void BOOST_PP_CAT(CONTAINER_TYPE, _hash_integer_tests())
|
||||
void HASH_TEST_CAT(CONTAINER_TYPE, _hash_integer_tests())
|
||||
{
|
||||
integer_tests((CONTAINER_TYPE<char>*) 0);
|
||||
integer_tests((CONTAINER_TYPE<int>*) 0);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
// issue 6.18.
|
||||
|
||||
// This implements the extensions to the standard.
|
||||
// It's undocumented, so you shouldn't use it....
|
||||
@ -22,8 +22,6 @@
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
|
||||
# include <array>
|
||||
@ -171,19 +169,66 @@ namespace boost
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
# define BOOST_HASH_TUPLE_F(z, n, _) \
|
||||
template< \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
> \
|
||||
inline std::size_t hash_value(std::tuple< \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, A) \
|
||||
> const& v) \
|
||||
{ \
|
||||
return boost::hash_detail::hash_tuple(v); \
|
||||
template<typename A0>
|
||||
inline std::size_t hash_value(std::tuple<A0> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3, typename A4>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
|
||||
inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> const& v)
|
||||
{
|
||||
return boost::hash_detail::hash_tuple(v);
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _)
|
||||
# undef BOOST_HASH_TUPLE_F
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user