diff DEPENDENCIES/generic/include/boost/pending/container_traits.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/pending/container_traits.hpp	Fri Sep 04 12:01:02 2015 +0100
+++ b/DEPENDENCIES/generic/include/boost/pending/container_traits.hpp	Mon Sep 07 11:12:49 2015 +0100
@@ -15,6 +15,7 @@
 #include <boost/next_prior.hpp>
 
 #include <algorithm>   // for std::remove
+#include <utility>
 #include <vector>
 #include <list>
 #include <map>
@@ -30,10 +31,20 @@
 #  endif
 #endif
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-// Stay out of the way of concept checking class templates
-# define Container Container_
-# define AssociativeContainer AssociativeContainer_
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+#include <unordered_set>
+#endif
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+#include <unordered_map>
+#endif
+
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#define BOOST_PENDING_FWD_TYPE(type) const type&
+#define BOOST_PENDING_FWD_VALUE(type, var) (var)
+#else
+#define BOOST_PENDING_FWD_TYPE(type) type&&
+#define BOOST_PENDING_FWD_VALUE(type, var) (std::forward<type>((var)))
 #endif
 
 // The content of this file is in 'graph_detail' because otherwise
@@ -87,14 +98,12 @@
   //======================================================================
   // Container Traits Class and container_category() function
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   // don't use this unless there is partial specialization 
   template <class Container>
   struct container_traits {
     typedef typename Container::category category;
     typedef typename Container::iterator_stability iterator_stability;
   };
-#endif
 
   // Use this as a compile-time assertion that X is stable
   inline void require_stable(stable_tag) { }
@@ -112,13 +121,11 @@
   unstable_tag iterator_stability(const std::vector<T,Alloc>&)
     { return unstable_tag(); }
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class T, class Alloc>
   struct container_traits< std::vector<T,Alloc> > {
     typedef vector_tag category;
     typedef unstable_tag iterator_stability;
   };
-#endif
 
   // std::list
   struct list_tag :
@@ -136,24 +143,20 @@
   stable_tag iterator_stability(const std::list<T,Alloc>&)
     { return stable_tag(); }
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class T, class Alloc>
   struct container_traits< std::list<T,Alloc> > {
     typedef list_tag category;
     typedef stable_tag iterator_stability;
   };
-#endif
 
 
   // std::slist
 #ifndef BOOST_NO_SLIST
-# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class T, class Alloc>
   struct container_traits<BOOST_STD_EXTENSION_NAMESPACE::slist<T,Alloc> > {
     typedef front_insertion_sequence_tag category;
     typedef stable_tag iterator_stability;
   };
-#endif
   template <class T, class Alloc>
   front_insertion_sequence_tag container_category(
   const BOOST_STD_EXTENSION_NAMESPACE::slist<T,Alloc>&
@@ -182,13 +185,11 @@
   stable_tag iterator_stability(const std::set<Key,Cmp,Alloc>&)
   { return stable_tag(); }
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class Key, class Cmp, class Alloc> 
   struct container_traits< std::set<Key,Cmp,Alloc> > {
     typedef set_tag category;
     typedef stable_tag iterator_stability;
   };
-#endif
 
   // std::multiset
   struct multiset_tag :
@@ -205,13 +206,11 @@
   stable_tag iterator_stability(const std::multiset<Key,Cmp,Alloc>&)
   { return stable_tag(); }
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class Key, class Cmp, class Alloc> 
   struct container_traits< std::multiset<Key,Cmp,Alloc> > {
     typedef multiset_tag category;
     typedef stable_tag iterator_stability;
   };
-#endif
 
   // deque
 
@@ -222,13 +221,11 @@
     virtual public unique_associative_container_tag 
     { };
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class Key, class T, class Cmp, class Alloc> 
   struct container_traits< std::map<Key,T,Cmp,Alloc> > {
     typedef map_tag category;
     typedef stable_tag iterator_stability;
   };
-#endif
 
   template <class Key, class T, class Cmp, class Alloc> 
   map_tag container_category(const std::map<Key,T,Cmp,Alloc>&)
@@ -245,13 +242,11 @@
     virtual public multiple_associative_container_tag 
     { };
 
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class Key, class T, class Cmp, class Alloc> 
   struct container_traits< std::multimap<Key,T,Cmp,Alloc> > {
     typedef multimap_tag category;
     typedef stable_tag iterator_stability;
   };
-#endif
 
   template <class Key, class T, class Cmp, class Alloc> 
   multimap_tag container_category(const std::multimap<Key,T,Cmp,Alloc>&)
@@ -286,8 +281,6 @@
     { };
 
 
-#ifndef BOOST_NO_HASH
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   template <class Key, class Eq, class Hash, class Alloc> 
   struct container_traits< boost::unordered_set<Key,Eq,Hash,Alloc> > {
     typedef unordered_set_tag category;
@@ -308,7 +301,7 @@
     typedef unordered_multimap_tag category;
     typedef unstable_tag iterator_stability;
   };
-#endif
+
   template <class Key, class Eq, class Hash, class Alloc>
   unordered_set_tag
   container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
@@ -345,8 +338,87 @@
   unstable_tag
   iterator_stability(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
   { return unstable_tag(); }
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+  template <class Key, class Eq, class Hash, class Alloc> 
+  struct container_traits< std::unordered_set<Key,Eq,Hash,Alloc> > {
+    typedef unordered_set_tag category;
+    typedef unstable_tag iterator_stability;
+  };
+#endif
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+  template <class Key, class T, class Eq, class Hash, class Alloc>
+  struct container_traits< std::unordered_map<Key,T,Eq,Hash,Alloc> > {
+    typedef unordered_map_tag category;
+    typedef unstable_tag iterator_stability;
+  };
+#endif
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+  template <class Key, class Eq, class Hash, class Alloc>
+  struct container_traits< std::unordered_multiset<Key,Eq,Hash,Alloc> > {
+    typedef unordered_multiset_tag category;
+    typedef unstable_tag iterator_stability;
+  };
+#endif
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+  template <class Key, class T, class Eq, class Hash, class Alloc>
+  struct container_traits< std::unordered_multimap<Key,T,Eq,Hash,Alloc> > {
+    typedef unordered_multimap_tag category;
+    typedef unstable_tag iterator_stability;
+  };
+#endif
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+  template <class Key, class Eq, class Hash, class Alloc>
+  unordered_set_tag
+  container_category(const std::unordered_set<Key,Eq,Hash,Alloc>&)
+  { return unordered_set_tag(); }
 #endif
 
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+  template <class Key, class T, class Eq, class Hash, class Alloc>
+  unordered_map_tag
+  container_category(const std::unordered_map<Key,T,Eq,Hash,Alloc>&)
+  { return unordered_map_tag(); }
+#endif
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+  template <class Key, class Eq, class Hash, class Alloc>
+  unstable_tag iterator_stability(const std::unordered_set<Key,Eq,Hash,Alloc>&)
+  { return unstable_tag(); }
+#endif
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+  template <class Key, class T, class Eq, class Hash, class Alloc>
+  unstable_tag iterator_stability(const std::unordered_map<Key,T,Eq,Hash,Alloc>&)
+  { return unstable_tag(); }
+#endif
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+  template <class Key, class Eq, class Hash, class Alloc>
+  unordered_multiset_tag
+  container_category(const std::unordered_multiset<Key,Eq,Hash,Alloc>&)
+  { return unordered_multiset_tag(); }
+#endif
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+  template <class Key, class T, class Eq, class Hash, class Alloc>
+  unordered_multimap_tag
+  container_category(const std::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
+  { return unordered_multimap_tag(); }
+#endif
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
+  template <class Key, class Eq, class Hash, class Alloc>
+  unstable_tag
+  iterator_stability(const std::unordered_multiset<Key,Eq,Hash,Alloc>&)
+  { return unstable_tag(); }
+#endif
+
+#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
+  template <class Key, class T, class Eq, class Hash, class Alloc>
+  unstable_tag
+  iterator_stability(const std::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
+  { return unstable_tag(); }
+#endif
 
 
   //===========================================================================
@@ -421,41 +493,41 @@
   // Push
   template <class Container, class T>
   std::pair<typename Container::iterator, bool>
-  push_dispatch(Container& c, const T& v, back_insertion_sequence_tag)
+  push_dispatch(Container& c, BOOST_PENDING_FWD_TYPE(T) v, back_insertion_sequence_tag)
   {
-    c.push_back(v);
+    c.push_back(BOOST_PENDING_FWD_VALUE(T, v));
     return std::make_pair(boost::prior(c.end()), true);
   }
 
   template <class Container, class T>
   std::pair<typename Container::iterator, bool>
-  push_dispatch(Container& c, const T& v, front_insertion_sequence_tag)
+  push_dispatch(Container& c, BOOST_PENDING_FWD_TYPE(T) v, front_insertion_sequence_tag)
   {
-    c.push_front(v);
+    c.push_front(BOOST_PENDING_FWD_VALUE(T, v));
     return std::make_pair(c.begin(), true);
   }
 
   template <class AssociativeContainer, class T>
   std::pair<typename AssociativeContainer::iterator, bool>
-  push_dispatch(AssociativeContainer& c, const T& v, 
+  push_dispatch(AssociativeContainer& c, BOOST_PENDING_FWD_TYPE(T) v, 
                 unique_associative_container_tag)
   {
-    return c.insert(v);
+    return c.insert(BOOST_PENDING_FWD_VALUE(T, v));
   }
 
   template <class AssociativeContainer, class T>
   std::pair<typename AssociativeContainer::iterator, bool>
-  push_dispatch(AssociativeContainer& c, const T& v,
+  push_dispatch(AssociativeContainer& c, BOOST_PENDING_FWD_TYPE(T) v,
                 multiple_associative_container_tag)
   {
-    return std::make_pair(c.insert(v), true);
+    return std::make_pair(c.insert(BOOST_PENDING_FWD_VALUE(T, v)), true);
   }
 
   template <class Container, class T>
   std::pair<typename Container::iterator,bool>
-  push(Container& c, const T& v)
+  push(Container& c, BOOST_PENDING_FWD_TYPE(T) v)
   {
-    return push_dispatch(c, v, container_category(c));
+    return push_dispatch(c, BOOST_PENDING_FWD_VALUE(T, v), container_category(c));
   }
 
   // Find
@@ -552,10 +624,7 @@
 
 }} // namespace boost::graph_detail
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-// Stay out of the way of concept checking class templates
-# undef Container
-# undef AssociativeContainer
-#endif
+#undef BOOST_PENDING_FWD_TYPE
+#undef BOOST_PENDING_FWD_VALUE
 
 #endif // BOOST_GRAPH_DETAIL_CONTAINER_TRAITS_H