diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 48a0170d..d953b313 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -182,18 +182,6 @@ #endif #endif -// BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES - -#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) -#if BOOST_COMP_CLANG && __cplusplus >= 201703 -#define BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 1 -#endif -#endif - -#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) -#define BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 0 -#endif - namespace boost { namespace unordered { namespace detail { diff --git a/include/boost/unordered/detail/type_traits.hpp b/include/boost/unordered/detail/type_traits.hpp index 3d7dcf67..3fe2f404 100644 --- a/include/boost/unordered/detail/type_traits.hpp +++ b/include/boost/unordered/detail/type_traits.hpp @@ -14,6 +14,25 @@ #include #include #include +#include + +#if !defined(BOOST_NO_CXX17_DEDUCTION_GUIDES) +#include +#include +#include +#endif + +// BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES + +#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) +#if !defined(BOOST_NO_CXX17_DEDUCTION_GUIDES) +#define BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 1 +#endif +#endif + +#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) +#define BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 0 +#endif namespace boost { namespace unordered { @@ -52,6 +71,37 @@ namespace boost { !boost::is_convertible::value && !boost::is_convertible::value; }; + +#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES + // https://eel.is/c++draft/container.requirements#container.alloc.reqmts-34 + // https://eel.is/c++draft/container.requirements#unord.req.general-243 + + template + constexpr bool const is_input_iterator_v = + !boost::is_integral::value; + + template struct is_allocator + { + constexpr static bool const value = false; + }; + + template + struct is_allocator().allocate(std::size_t{}))> > + { + constexpr static bool const value = true; + }; + + template + constexpr bool const is_allocator_v = is_allocator::value; + + template + constexpr bool const is_hash_v = + !boost::is_integral::value && !is_allocator_v; + + template constexpr bool const is_pred_v = !is_allocator_v

; +#endif } // namespace detail } // namespace unordered } // namespace boost