Add transparent_non_iterable type trait for usage in erase() / extract() SFINAE

This commit is contained in:
Christian Mazakas
2021-12-21 09:21:51 -08:00
parent 85cb09ae6d
commit ff4d25d454

View File

@ -36,6 +36,7 @@
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_empty.hpp>
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
@ -718,6 +719,19 @@ namespace boost {
is_transparent<A>::value && is_transparent<B>::value;
};
template <class Key, class UnorderedMap> struct transparent_non_iterable
{
typedef typename UnorderedMap::hasher hash;
typedef typename UnorderedMap::key_equal key_equal;
typedef typename UnorderedMap::iterator iterator;
typedef typename UnorderedMap::const_iterator const_iterator;
static bool const value =
are_transparent<Key, hash, key_equal>::value &&
!boost::is_convertible<Key, iterator>::value &&
!boost::is_convertible<Key, const_iterator>::value;
};
////////////////////////////////////////////////////////////////////////////
// Explicitly call a destructor