diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:24:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:25:39 +0900 |
commit | 4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch) | |
tree | fd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/phoenix/stl/container/detail/container.hpp | |
parent | b5c87084afaef42b2d058f68091be31988a6a874 (diff) | |
download | boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.gz boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.bz2 boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.zip |
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/phoenix/stl/container/detail/container.hpp')
-rw-r--r-- | boost/phoenix/stl/container/detail/container.hpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/boost/phoenix/stl/container/detail/container.hpp b/boost/phoenix/stl/container/detail/container.hpp index fb6cad2fe9..b92472b237 100644 --- a/boost/phoenix/stl/container/detail/container.hpp +++ b/boost/phoenix/stl/container/detail/container.hpp @@ -12,6 +12,7 @@ #include <boost/mpl/eval_if.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_convertible.hpp> namespace boost { namespace phoenix { namespace stl { @@ -110,8 +111,8 @@ namespace boost { namespace phoenix { namespace stl // // has_mapped_type<C> // -// Given a container C, determine if it is a map or multimap -// by checking if it has a member type named "mapped_type". +// Given a container C, determine if it is a map, multimap, unordered_map, +// or unordered_multimap by checking if it has a member type named "mapped_type". // /////////////////////////////////////////////////////////////////////////////// namespace stl_impl @@ -135,6 +136,43 @@ namespace boost { namespace phoenix { namespace stl /////////////////////////////////////////////////////////////////////////////// // +// has_key_type<C> +// +// Given a container C, determine if it is a Associative Container +// by checking if it has a member type named "key_type". +// +/////////////////////////////////////////////////////////////////////////////// + namespace stl_impl + { + template <typename C> + one has_key_type(typename C::key_type(*)()); + + template <typename C> + two has_key_type(...); + } + + template <typename C> + struct has_key_type + : boost::mpl::bool_< + sizeof(stl_impl::has_key_type<C>(0)) == sizeof(stl_impl::one) + > + {}; + +/////////////////////////////////////////////////////////////////////////////// +// +// is_key_type_of<C, Arg> +// +// Lazy evaluation friendly predicate. +// +/////////////////////////////////////////////////////////////////////////////// + + template <typename C, typename Arg> + struct is_key_type_of + : boost::is_convertible<Arg, typename key_type_of<C>::type> + {}; + +/////////////////////////////////////////////////////////////////////////////// +// // map_insert_returns_pair<C> // // Distinguish a map from a multimap by checking the return type |