From ff4d25d45404a8c7983133193909dd2ede761ce7 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 21 Dec 2021 09:21:51 -0800 Subject: [PATCH] Add `transparent_non_iterable` type trait for usage in `erase()` / `extract()` SFINAE --- include/boost/unordered/detail/implementation.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 23c4314a..935cbb30 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -718,6 +719,19 @@ namespace boost { is_transparent::value && is_transparent::value; }; + template 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::value && + !boost::is_convertible::value && + !boost::is_convertible::value; + }; + //////////////////////////////////////////////////////////////////////////// // Explicitly call a destructor