summaryrefslogtreecommitdiff
path: root/boost/phoenix/stl
diff options
context:
space:
mode:
Diffstat (limited to 'boost/phoenix/stl')
-rw-r--r--boost/phoenix/stl/algorithm/detail/is_std_hash_map.hpp50
-rw-r--r--boost/phoenix/stl/algorithm/detail/is_std_hash_set.hpp46
-rw-r--r--boost/phoenix/stl/algorithm/detail/is_std_list.hpp2
-rw-r--r--boost/phoenix/stl/algorithm/detail/is_std_map.hpp2
-rw-r--r--boost/phoenix/stl/algorithm/detail/is_std_set.hpp2
-rw-r--r--boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp7
-rw-r--r--boost/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp70
-rw-r--r--boost/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp62
-rw-r--r--boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp74
-rw-r--r--boost/phoenix/stl/algorithm/transformation.hpp4
-rw-r--r--boost/phoenix/stl/container/container.hpp39
-rw-r--r--boost/phoenix/stl/container/detail/container.hpp42
12 files changed, 90 insertions, 310 deletions
diff --git a/boost/phoenix/stl/algorithm/detail/is_std_hash_map.hpp b/boost/phoenix/stl/algorithm/detail/is_std_hash_map.hpp
index 7a02b4fd61..e100472fcc 100644
--- a/boost/phoenix/stl/algorithm/detail/is_std_hash_map.hpp
+++ b/boost/phoenix/stl/algorithm/detail/is_std_hash_map.hpp
@@ -15,8 +15,12 @@
#ifndef BOOST_PHOENIX_IS_STD_HASH_MAP_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_HASH_MAP_EN_16_12_2004
+#include <boost/phoenix/config.hpp>
#include <boost/mpl/bool.hpp>
-#include "./std_hash_map_fwd.hpp"
+
+#ifdef BOOST_PHOENIX_HAS_HASH
+#include BOOST_PHOENIX_HASH_MAP_HEADER
+#endif
namespace boost
{
@@ -30,49 +34,15 @@ namespace boost
: boost::mpl::false_
{};
-#ifdef BOOST_HAS_HASH
-
- template<
- class Kty
- , class Ty
- , class Hash
- , class Cmp
- , class Alloc
- >
- struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Hash,Cmp,Alloc> >
- : boost::mpl::true_
- {};
-
- template<
- class Kty
- , class Ty
- , class Hash
- , class Cmp
- , class Alloc
- >
- struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Hash,Cmp,Alloc> >
- : boost::mpl::true_
- {};
-
-#elif defined(BOOST_DINKUMWARE_STDLIB)
+#ifdef BOOST_PHOENIX_HAS_HASH
- template<
- class Kty
- , class Ty
- , class Tr
- , class Alloc
- >
- struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Tr,Alloc> >
+ template<class Kty,class Ty,BOOST_PHOENIX_HASH_template_rest_param>
+ struct is_std_hash_map< ::BOOST_PHOENIX_HASH_NAMESPACE::hash_map<Kty,Ty,BOOST_PHOENIX_HASH_type_rest_param> >
: boost::mpl::true_
{};
- template<
- class Kty
- , class Ty
- , class Tr
- , class Alloc
- >
- struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Tr,Alloc> >
+ template<class Kty,class Ty,BOOST_PHOENIX_HASH_template_rest_param>
+ struct is_std_hash_multimap< ::BOOST_PHOENIX_HASH_NAMESPACE::hash_multimap<Kty,Ty,BOOST_PHOENIX_HASH_type_rest_param> >
: boost::mpl::true_
{};
diff --git a/boost/phoenix/stl/algorithm/detail/is_std_hash_set.hpp b/boost/phoenix/stl/algorithm/detail/is_std_hash_set.hpp
index c6631ad705..d57785548a 100644
--- a/boost/phoenix/stl/algorithm/detail/is_std_hash_set.hpp
+++ b/boost/phoenix/stl/algorithm/detail/is_std_hash_set.hpp
@@ -15,8 +15,12 @@
#ifndef BOOST_PHOENIX_IS_STD_HASH_SET_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_HASH_SET_EN_16_12_2004
+#include <boost/phoenix/config.hpp>
#include <boost/mpl/bool.hpp>
-#include "./std_hash_set_fwd.hpp"
+
+#ifdef BOOST_PHOENIX_HAS_HASH
+#include BOOST_PHOENIX_HASH_SET_HEADER
+#endif
namespace boost
{
@@ -30,45 +34,15 @@ namespace boost
: boost::mpl::false_
{};
-#if defined(BOOST_HAS_HASH)
-
- template<
- class Kty
- , class Hash
- , class Cmp
- , class Alloc
- >
- struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Hash,Cmp,Alloc> >
- : boost::mpl::true_
- {};
-
- template<
- class Kty
- , class Hash
- , class Cmp
- , class Alloc
- >
- struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Hash,Cmp,Alloc> >
- : boost::mpl::true_
- {};
-
-#elif defined(BOOST_DINKUMWARE_STDLIB)
+#ifdef BOOST_PHOENIX_HAS_HASH
- template<
- class Kty
- , class Tr
- , class Alloc
- >
- struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Tr,Alloc> >
+ template<class Kty,BOOST_PHOENIX_HASH_template_rest_param>
+ struct is_std_hash_set< ::BOOST_PHOENIX_HASH_NAMESPACE::hash_set<Kty,BOOST_PHOENIX_HASH_type_rest_param> >
: boost::mpl::true_
{};
- template<
- class Kty
- , class Tr
- , class Alloc
- >
- struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Tr,Alloc> >
+ template<class Kty,BOOST_PHOENIX_HASH_template_rest_param>
+ struct is_std_hash_multiset< ::BOOST_PHOENIX_HASH_NAMESPACE::hash_multiset<Kty,BOOST_PHOENIX_HASH_type_rest_param> >
: boost::mpl::true_
{};
diff --git a/boost/phoenix/stl/algorithm/detail/is_std_list.hpp b/boost/phoenix/stl/algorithm/detail/is_std_list.hpp
index 390f592b7b..cc8d18fcaf 100644
--- a/boost/phoenix/stl/algorithm/detail/is_std_list.hpp
+++ b/boost/phoenix/stl/algorithm/detail/is_std_list.hpp
@@ -16,7 +16,7 @@
#define BOOST_PHOENIX_IS_STD_LIST_EN_16_12_2004
#include <boost/mpl/bool.hpp>
-#include <boost/detail/container_fwd.hpp>
+#include <list>
namespace boost
{
diff --git a/boost/phoenix/stl/algorithm/detail/is_std_map.hpp b/boost/phoenix/stl/algorithm/detail/is_std_map.hpp
index 58aba6220c..2aea278c42 100644
--- a/boost/phoenix/stl/algorithm/detail/is_std_map.hpp
+++ b/boost/phoenix/stl/algorithm/detail/is_std_map.hpp
@@ -16,7 +16,7 @@
#define BOOST_PHOENIX_IS_STD_MAP_EN_16_12_2004
#include <boost/mpl/bool.hpp>
-#include <boost/detail/container_fwd.hpp>
+#include <map>
namespace boost
{
diff --git a/boost/phoenix/stl/algorithm/detail/is_std_set.hpp b/boost/phoenix/stl/algorithm/detail/is_std_set.hpp
index e44a04765f..cbc4241ad2 100644
--- a/boost/phoenix/stl/algorithm/detail/is_std_set.hpp
+++ b/boost/phoenix/stl/algorithm/detail/is_std_set.hpp
@@ -20,7 +20,7 @@
#define BOOST_PHOENIX_IS_STD_SET_EN_16_12_2004
#include <boost/mpl/bool.hpp>
-#include <boost/detail/container_fwd.hpp>
+#include <set>
namespace boost
{
diff --git a/boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp b/boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp
index 5a4be127b5..54b5f2f408 100644
--- a/boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp
+++ b/boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp
@@ -20,8 +20,13 @@
#ifndef BOOST_PHOENIX_IS_STD_UNORDERED_SET_OR_MAP
#define BOOST_PHOENIX_IS_STD_UNORDERED_SET_OR_MAP
+#include <boost/phoenix/config.hpp>
#include <boost/mpl/bool.hpp>
-#include "./std_unordered_set_or_map_fwd.hpp"
+
+#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
+#include BOOST_PHOENIX_UNORDERED_SET_HEADER
+#include BOOST_PHOENIX_UNORDERED_MAP_HEADER
+#endif
namespace boost
{
diff --git a/boost/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp b/boost/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp
deleted file mode 100644
index 3688897fa3..0000000000
--- a/boost/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2005 Daniel Wallin.
-// Copyright 2005 Joel de Guzman.
-//
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Modeled after range_ex, Copyright 2004 Eric Niebler
-///////////////////////////////////////////////////////////////////////////////
-//
-// std_hash_map_fwd.hpp
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-#ifndef BOOST_PHOENIX_STD_HASH_MAP_FWD_EN_16_12_2004
-#define BOOST_PHOENIX_STD_HASH_MAP_FWD_EN_16_12_2004
-
-#include <boost/phoenix/config.hpp>
-
-#if defined(BOOST_HAS_HASH)
-
-namespace BOOST_STD_EXTENSION_NAMESPACE
-{
- template<
- class Kty
- , class Ty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class hash_map;
-
- template<
- class Kty
- , class Ty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class hash_multimap;
-}
-
-#elif defined(BOOST_DINKUMWARE_STDLIB)
-
-namespace BOOST_STD_EXTENSION_NAMESPACE
-{
- template<
- class Kty
- , class Ty
- , class Tr
- , class Alloc
- >
- class hash_map;
-
- template<
- class Kty
- , class Ty
- , class Tr
- , class Alloc
- >
- class hash_multimap;
-}
-
-#endif
-
-#endif
diff --git a/boost/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp b/boost/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp
deleted file mode 100644
index 54049db891..0000000000
--- a/boost/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2005 Daniel Wallin.
-// Copyright 2005 Joel de Guzman.
-//
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Modeled after range_ex, Copyright 2004 Eric Niebler
-///////////////////////////////////////////////////////////////////////////////
-//
-// std_hash_set_fwd.hpp
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_PHOENIX_STD_HASH_SET_FWD_EN_16_12_2004
-#define BOOST_PHOENIX_STD_HASH_SET_FWD_EN_16_12_2004
-
-#include <boost/phoenix/config.hpp>
-
-#if defined(BOOST_HAS_HASH)
-
-namespace BOOST_STD_EXTENSION_NAMESPACE
-{
- template<
- class Kty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class hash_set;
-
- template<
- class Kty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class hash_multiset;
-}
-
-#elif defined(BOOST_DINKUMWARE_STDLIB)
-
-namespace BOOST_STD_EXTENSION_NAMESPACE
-{
- template<
- class Kty
- , class Tr
- , class Alloc
- >
- class hash_set;
-
- template<
- class Kty
- , class Tr
- , class Alloc
- >
- class hash_multiset;
-}
-
-#endif
-
-#endif
diff --git a/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp b/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp
deleted file mode 100644
index e650328d15..0000000000
--- a/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Copyright 2005 Daniel Wallin.
-// Copyright 2005 Joel de Guzman.
-// Copyright 2015 John Fletcher
-//
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Modeled after range_ex, Copyright 2004 Eric Niebler
-///////////////////////////////////////////////////////////////////////////////
-//
-// std_unordered_set_or_map_fwd.hpp
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_PHOENIX_STD_UNORDERED_SET_OR_MAP_FWD
-#define BOOST_PHOENIX_STD_UNORDERED_SET_OR_MAP_FWD
-
-#include <boost/phoenix/config.hpp>
-
-#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
-#if defined(BOOST_PHOENIX_USING_LIBCPP) \
- || (defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 540))
-// Advance declaration not working for libc++ and MSVC 10
-#include BOOST_PHOENIX_UNORDERED_SET_HEADER
-#include BOOST_PHOENIX_UNORDERED_MAP_HEADER
-#else
-
-
-
-namespace std {
-
-
- template<
- class Kty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class unordered_set;
-
- template<
- class Kty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class unordered_multiset;
-
- template<
- class Kty
- , class Ty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class unordered_map;
-
- template<
- class Kty
- , class Ty
- , class Hash
- , class Cmp
- , class Alloc
- >
- class unordered_multimap;
-}
-#endif
-
-
-#endif
-
-#endif
diff --git a/boost/phoenix/stl/algorithm/transformation.hpp b/boost/phoenix/stl/algorithm/transformation.hpp
index 37fd967af1..88389c1270 100644
--- a/boost/phoenix/stl/algorithm/transformation.hpp
+++ b/boost/phoenix/stl/algorithm/transformation.hpp
@@ -515,6 +515,7 @@ namespace boost { namespace phoenix { namespace impl
}
};
+#ifndef BOOST_NO_CXX98_RANDOM_SHUFFLE
struct random_shuffle
{
typedef void result_type;
@@ -531,6 +532,7 @@ namespace boost { namespace phoenix { namespace impl
return std::random_shuffle(detail::begin_(r), detail::end_(r), g);
}
};
+#endif
struct partition
{
@@ -1148,8 +1150,10 @@ namespace boost { namespace phoenix
BOOST_PHOENIX_ADAPT_CALLABLE(reverse_copy, impl::reverse_copy, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(rotate, impl::rotate, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(rotate_copy, impl::rotate_copy, 3)
+#ifndef BOOST_NO_CXX98_RANDOM_SHUFFLE
BOOST_PHOENIX_ADAPT_CALLABLE(random_shuffle, impl::random_shuffle, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(random_shuffle, impl::random_shuffle, 2)
+#endif
BOOST_PHOENIX_ADAPT_CALLABLE(partition, impl::partition, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(stable_partition, impl::stable_partition, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(sort, impl::sort, 1)
diff --git a/boost/phoenix/stl/container/container.hpp b/boost/phoenix/stl/container/container.hpp
index 907b0eb6cd..d2b8c24ac0 100644
--- a/boost/phoenix/stl/container/container.hpp
+++ b/boost/phoenix/stl/container/container.hpp
@@ -33,7 +33,7 @@ namespace boost { namespace phoenix
// Lazy functions are provided for all of the member functions of the
// following containers:
//
-// deque - list - map - multimap - vector.
+// deque - list - map - multimap - vector - set - multiset.
//
// Indeed, should *your* class have member functions with the same names
// and signatures as those listed below, then it will automatically be
@@ -286,32 +286,25 @@ namespace boost { namespace phoenix
template <typename C, typename Arg1, typename Arg2 = mpl::void_>
struct erase
{
- // BOOST_MSVC #if branch here in map_erase_result non-
- // standard behavior. The return type should be void but
- // VC7.1 prefers to return iterator_of<C>. As a result,
- // VC7.1 complains of error C2562:
- // boost::phoenix::stl::erase::operator() 'void' function
- // returning a value. Oh well... :*
-
+ // MSVC and libc++ always returns iterator even in C++03 mode.
typedef
- boost::mpl::eval_if_c<
- boost::is_same<
- typename remove_reference<Arg1>::type
- , typename iterator_of<C>::type
- >::value
-#if defined(BOOST_MSVC)// && (BOOST_MSVC <= 1500)
+ boost::mpl::eval_if<
+ is_key_type_of<C, Arg1>
+ , size_type_of<C>
+#if defined(BOOST_MSVC) /*&& (BOOST_MSVC <= 1500)*/ \
+ && (defined(BOOST_LIBSTDCXX11) && 40500 <= BOOST_LIBSTDCXX_VERSION) \
+ && defined(_LIBCPP_VERSION)
, iterator_of<C>
#else
, boost::mpl::identity<void>
#endif
- , size_type_of<C>
>
- map_erase_result;
+ assoc_erase_result;
typedef typename
boost::mpl::eval_if_c<
- has_mapped_type<C>::value
- , map_erase_result
+ has_key_type<C>::value
+ , assoc_erase_result
, iterator_of<C>
>::type
type;
@@ -322,18 +315,20 @@ namespace boost { namespace phoenix
{
// This mouthful can differentiate between the generic erase
// functions (Container == std::deque, std::list, std::vector) and
- // that specific to the two map-types, std::map and std::multimap.
+ // that specific to Associative Containers.
//
// where C is a std::deque, std::list, std::vector:
//
// 1) iterator C::erase(iterator where);
// 2) iterator C::erase(iterator first, iterator last);
//
- // where M is a std::map or std::multimap:
+ // where C is a std::map, std::multimap, std::set, or std::multiset:
//
// 3) size_type M::erase(const Key& keyval);
- // 4) void M::erase(iterator where);
- // 5) void M::erase(iterator first, iterator last);
+ // 4-a) void M::erase(iterator where);
+ // 4-b) iterator M::erase(iterator where);
+ // 5-a) void M::erase(iterator first, iterator last);
+ // 5-b) iterator M::erase(iterator first, iterator last);
template <typename Sig>
struct result;
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