diff options
author | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
commit | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch) | |
tree | 7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/pending | |
parent | bb4dd8289b351fae6b55e303f189127a394a1edd (diff) | |
download | boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2 boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip |
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/pending')
-rw-r--r-- | boost/pending/container_traits.hpp | 145 | ||||
-rw-r--r-- | boost/pending/cstddef.hpp | 16 | ||||
-rw-r--r-- | boost/pending/detail/int_iterator.hpp | 11 | ||||
-rw-r--r-- | boost/pending/indirect_cmp.hpp | 5 | ||||
-rw-r--r-- | boost/pending/integer_log2.hpp | 113 | ||||
-rw-r--r-- | boost/pending/iterator_tests.hpp | 30 | ||||
-rw-r--r-- | boost/pending/property.hpp | 105 | ||||
-rw-r--r-- | boost/pending/relaxed_heap.hpp | 2 |
8 files changed, 187 insertions, 240 deletions
diff --git a/boost/pending/container_traits.hpp b/boost/pending/container_traits.hpp index 7cdf38c7d9..a58b524503 100644 --- a/boost/pending/container_traits.hpp +++ b/boost/pending/container_traits.hpp @@ -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 @@ namespace boost { namespace graph_detail { //====================================================================== // 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { { }; -#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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { 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 @@ namespace boost { namespace graph_detail { // 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 { namespace graph_detail { }} // 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 diff --git a/boost/pending/cstddef.hpp b/boost/pending/cstddef.hpp deleted file mode 100644 index 440629e265..0000000000 --- a/boost/pending/cstddef.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// -*- C++ -*- forwarding header. -// (C) Copyright Jeremy Siek 2004 -// Distributed under 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) - -#ifndef BOOST_CSTDDEF_HPP -#define BOOST_CSTDDEF_HPP - -#if defined(__sgi) && !defined(__GNUC__) -# include <stddef.h> -#else -# include <cstddef> -#endif - -#endif diff --git a/boost/pending/detail/int_iterator.hpp b/boost/pending/detail/int_iterator.hpp index e3bae34ce7..ca8372bf9d 100644 --- a/boost/pending/detail/int_iterator.hpp +++ b/boost/pending/detail/int_iterator.hpp @@ -15,6 +15,7 @@ #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE namespace boost { +namespace iterators { #endif // this should use random_access_iterator_helper but I've had @@ -61,13 +62,19 @@ inline int_iterator<IntT> operator+(IntT n, int_iterator<IntT> t) { t += n; return t; } #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE +} /* namespace iterators */ + +using iterators::int_iterator; + } /* namespace boost */ #endif #ifdef BOOST_NO_OPERATORS_IN_NAMESPACE namespace boost { - using ::int_iterator; -} +using ::int_iterator; +namespace iterators { +using ::int_iterator; +}} #endif diff --git a/boost/pending/indirect_cmp.hpp b/boost/pending/indirect_cmp.hpp index 638625cecd..14ee5314af 100644 --- a/boost/pending/indirect_cmp.hpp +++ b/boost/pending/indirect_cmp.hpp @@ -33,14 +33,15 @@ namespace boost { typedef typename boost::property_traits<ReadablePropertyMap>::key_type K; typedef K first_argument_type; typedef K second_argument_type; - typedef T result_type; + typedef bool result_type; inline indirect_cmp(const ReadablePropertyMap& df, const Compare& c = Compare()) : d(df), cmp(c) { } template <class A, class B> inline bool operator()(const A& u, const B& v) const { - T du = get(d, u), dv = get(d, v); + const T& du = get(d, u); + const T& dv = get(d, v); return cmp(du, dv); } protected: diff --git a/boost/pending/integer_log2.hpp b/boost/pending/integer_log2.hpp index f4bc84600c..023ec7af03 100644 --- a/boost/pending/integer_log2.hpp +++ b/boost/pending/integer_log2.hpp @@ -1,112 +1,9 @@ -// ----------------------------------------------------------- -// integer_log2.hpp -// -// Gives the integer part of the logarithm, in base 2, of a -// given number. Behavior is undefined if the argument is <= 0. -// -// Copyright (c) 2003-2004, 2008 Gennaro Prota -// -// Distributed under 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) -// -// ----------------------------------------------------------- +#ifndef BOOST_PENDING_INTEGER_LOG2_HPP +#define BOOST_PENDING_INTEGER_LOG2_HPP -#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301 -#define BOOST_INTEGER_LOG2_HPP_GP_20030301 +// The header file at this path is deprecated; +// use boost/integer/integer_log2.hpp instead. -#include <assert.h> -#ifdef __BORLANDC__ -#include <climits> -#endif -#include "boost/limits.hpp" -#include "boost/config.hpp" - - -namespace boost { - namespace detail { - - template <typename T> - int integer_log2_impl(T x, int n) { - - int result = 0; - - while (x != 1) { - - const T t = static_cast<T>(x >> n); - if (t) { - result += n; - x = t; - } - n /= 2; - - } - - return result; - } - - - - // helper to find the maximum power of two - // less than p (more involved than necessary, - // to avoid PTS) - // - template <int p, int n> - struct max_pow2_less { - - enum { c = 2*n < p }; - - BOOST_STATIC_CONSTANT(int, value = - c ? (max_pow2_less< c*p, 2*c*n>::value) : n); - - }; - - template <> - struct max_pow2_less<0, 0> { +#include <boost/integer/integer_log2.hpp> - BOOST_STATIC_CONSTANT(int, value = 0); - }; - - // this template is here just for Borland :( - // we could simply rely on numeric_limits but sometimes - // Borland tries to use numeric_limits<const T>, because - // of its usual const-related problems in argument deduction - // - gps - template <typename T> - struct width { - -#ifdef __BORLANDC__ - BOOST_STATIC_CONSTANT(int, value = sizeof(T) * CHAR_BIT); -#else - BOOST_STATIC_CONSTANT(int, value = (std::numeric_limits<T>::digits)); #endif - - }; - - } // detail - - - // --------- - // integer_log2 - // --------------- - // - template <typename T> - int integer_log2(T x) { - - assert(x > 0); - - const int n = detail::max_pow2_less< - detail::width<T> :: value, 4 - > :: value; - - return detail::integer_log2_impl(x, n); - - } - - - -} - - - -#endif // include guard diff --git a/boost/pending/iterator_tests.hpp b/boost/pending/iterator_tests.hpp index dd5fe2ddd6..37c839b760 100644 --- a/boost/pending/iterator_tests.hpp +++ b/boost/pending/iterator_tests.hpp @@ -25,28 +25,26 @@ # include <boost/static_assert.hpp> # include <boost/concept_archetype.hpp> // for detail::dummy_constructor # include <boost/implicit_cast.hpp> -# include <boost/type_traits/broken_compiler_spec.hpp> namespace boost { // use this for the value type -struct dummyT { +struct dummyT { dummyT() { } dummyT(detail::dummy_constructor) { } dummyT(int x) : m_x(x) { } - int foo() const { return m_x; } + int foo() const { return m_x; } bool operator==(const dummyT& d) const { return m_x == d.m_x; } int m_x; }; } -BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT) - namespace boost { +namespace iterators { // Tests whether type Iterator satisfies the requirements for a -// TrivialIterator. +// TrivialIterator. // Preconditions: i != j, *i == val template <class Iterator, class T> void trivial_iterator_test(const Iterator i, const Iterator j, T val) @@ -87,7 +85,7 @@ void mutable_trivial_iterator_test(const Iterator i, const Iterator j, T val) // Preconditions: *i == v1, *++i == v2 template <class Iterator, class T> -void input_iterator_test(Iterator i, T v1, T v2) +void input_iterator_test(Iterator i, T v1, T v2) { Iterator i1(i); @@ -153,7 +151,7 @@ template <> struct lvalue_test<true> { #endif template <class Iterator, class T> -void forward_iterator_test(Iterator i, T v1, T v2) +void forward_iterator_test(Iterator i, T v1, T v2) { input_iterator_test(i, v1, v2); @@ -218,7 +216,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) int c; typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type; - + for (c = 0; c < N-1; ++c) { assert(i == j + c); assert(*i == vals[c]); @@ -237,7 +235,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) assert(i == k - c); assert(*i == vals[N - 1 - c]); assert(*i == boost::implicit_cast<value_type>(j[N - 1 - c])); - Iterator q = k - c; + Iterator q = k - c; assert(*i == *q); assert(i > j); assert(i >= j); @@ -263,6 +261,18 @@ void const_nonconst_iterator_test(Iterator i, ConstIterator j) assert(i == k); } +} // namespace iterators + +using iterators::undefined; +using iterators::trivial_iterator_test; +using iterators::mutable_trivial_iterator_test; +using iterators::input_iterator_test; +using iterators::lvalue_test; +using iterators::forward_iterator_test; +using iterators::bidirectional_iterator_test; +using iterators::random_access_iterator_test; +using iterators::const_nonconst_iterator_test; + } // namespace boost #endif // BOOST_ITERATOR_TESTS_HPP diff --git a/boost/pending/property.hpp b/boost/pending/property.hpp index 93ebffbf3b..e63a2d203f 100644 --- a/boost/pending/property.hpp +++ b/boost/pending/property.hpp @@ -11,6 +11,7 @@ #include <boost/mpl/has_xxx.hpp> #include <boost/utility/enable_if.hpp> #include <boost/type_traits.hpp> +#include <boost/static_assert.hpp> namespace boost { @@ -53,8 +54,8 @@ namespace boost { enum graph_bundle_t {graph_bundle}; // Code to look up one property in a property list: - template <typename PList, typename PropName> - struct lookup_one_property_internal {BOOST_STATIC_CONSTANT(bool, found = false);}; + template <typename PList, typename PropName, typename Enable = void> + struct lookup_one_property_internal {BOOST_STATIC_CONSTANT(bool, found = false); typedef void type;}; // Special-case properties (vertex_all, edge_all, graph_all) #define BGL_ALL_PROP(tag) \ @@ -93,8 +94,14 @@ namespace boost { private: \ typedef lookup_one_property_internal<Base, BOOST_JOIN(kind, _bundle_t)> base_type; \ public: \ - static typename base_type::type& lookup(property<Tag, T, Base>& p, BOOST_JOIN(kind, _bundle_t)) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \ - static const typename base_type::type& lookup(const property<Tag, T, Base>& p, BOOST_JOIN(kind, _bundle_t)) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \ + template <typename BundleTag> \ + static typename lazy_enable_if_c<(base_type::found && (is_same<BundleTag, BOOST_JOIN(kind, _bundle_t)>::value)), \ + add_reference<typename base_type::type> >::type \ + lookup(property<Tag, T, Base>& p, BundleTag) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \ + template <typename BundleTag> \ + static typename lazy_enable_if_c<(base_type::found && (is_same<BundleTag, BOOST_JOIN(kind, _bundle_t)>::value)), \ + add_reference<const typename base_type::type> >::type \ + lookup(const property<Tag, T, Base>& p, BundleTag) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \ }; \ BGL_DO_ONE_BUNDLE_TYPE(vertex) @@ -122,12 +129,14 @@ namespace boost { typedef lookup_one_property_internal<Base, PropName> base_type; public: template <typename PL> - static typename enable_if<is_same<PL, boost::property<Tag, T, Base> >, typename base_type::type&>::type + static typename lazy_enable_if<is_same<PL, boost::property<Tag, T, Base> >, + add_reference<typename base_type::type> >::type lookup(PL& prop, const PropName& tag) { return base_type::lookup(prop.m_base, tag); } template <typename PL> - static typename enable_if<is_same<PL, boost::property<Tag, T, Base> >, const typename base_type::type&>::type + static typename lazy_enable_if<is_same<PL, boost::property<Tag, T, Base> >, + add_reference<const typename base_type::type> >::type lookup(const PL& prop, const PropName& tag) { return base_type::lookup(prop.m_base, tag); } @@ -135,12 +144,12 @@ namespace boost { // Pointer-to-member access to bundled properties #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template <typename T, typename R> - struct lookup_one_property_internal<T, R T::*> { + template <typename T, typename TMaybeBase, typename R> + struct lookup_one_property_internal<T, R TMaybeBase::*, typename enable_if<is_base_of<TMaybeBase, T> >::type> { BOOST_STATIC_CONSTANT(bool, found = true); typedef R type; - static R& lookup(T& x, R T::*ptr) {return x.*ptr;} - static const R& lookup(const T& x, R T::*ptr) {return x.*ptr;} + static R& lookup(T& x, R TMaybeBase::*ptr) {return x.*ptr;} + static const R& lookup(const T& x, R TMaybeBase::*ptr) {return x.*ptr;} }; #endif @@ -153,7 +162,8 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, found = (lookup_one_property_internal<T, Tag>::found)); typedef const typename lookup_one_property_internal<T, Tag>::type type; template <typename U> - static typename enable_if<is_same<T, U>, const typename lookup_one_property_internal<T, Tag>::type&>::type + static typename lazy_enable_if<is_same<T, U>, + add_reference<const typename lookup_one_property_internal<T, Tag>::type> >::type lookup(const U& p, Tag tag) { return lookup_one_property_internal<T, Tag>::lookup(p, tag); } @@ -199,58 +209,6 @@ namespace boost { : mpl::bool_<is_same<T, no_property>::value> { }; - /** @internal @name Retag Property List - * This metafunction is used internally to normalize a property if it is - * actually modeling a property. Specifically this is used in Boost.Graph - * to map user-provided classes into bundled properties. - */ - //@{ - // One base case of the recursive form (see below). This matches any - // retag request that does not include a property<...> or no_property as - // the FinalType. This is used for generating bundles in Boost.Graph. - template<typename FinalTag, typename FinalType> - struct retag_property_list - { - typedef property<FinalTag, FinalType> type; - typedef FinalType retagged; - }; - - // Recursively retag the nested property list. - template<typename FinalTag, typename Tag, typename T, typename Base> - struct retag_property_list<FinalTag, property<Tag, T, Base> > - { - private: - typedef retag_property_list<FinalTag, Base> next; - - public: - typedef property<Tag, T, typename next::type> type; - typedef typename next::retagged retagged; - }; - - // This base case will correctly deduce the final property type if the - // retagged property is given in property form. This should not hide - // the base case below. - // NOTE: This addresses a problem of layering bundled properties in the BGL - // where multiple retaggings will fail to deduce the correct retagged - // type. - template<typename FinalTag, typename FinalType> - struct retag_property_list<FinalTag, property<FinalTag, FinalType> > - { - public: - typedef property<FinalTag, FinalType> type; - typedef FinalType retagged; - }; - - // A final base case of the retag_property_list, this will terminate a - // properly structured list. - template<typename FinalTag> - struct retag_property_list<FinalTag, no_property> - { - typedef no_property type; - typedef no_property retagged; - }; - //@} - template <typename PList, typename Tag> class lookup_one_property_f; @@ -286,6 +244,27 @@ namespace boost { } // namespace detail +namespace detail { + // Stuff for directed_graph and undirected_graph to skip over their first + // vertex_index and edge_index properties when providing vertex_all and + // edge_all; make sure you know the exact structure of your properties if you + // use there. + struct remove_first_property { + template <typename F> + struct result { + typedef typename boost::function_traits<F>::arg1_type a1; + typedef typename boost::remove_reference<a1>::type non_ref; + typedef typename non_ref::next_type nx; + typedef typename boost::mpl::if_<boost::is_const<non_ref>, boost::add_const<nx>, nx>::type with_const; + typedef typename boost::add_reference<with_const>::type type; + }; + template <typename Prop> + typename Prop::next_type& operator()(Prop& p) const {return p.m_base;} + template <typename Prop> + const typename Prop::next_type& operator()(const Prop& p) const {return p.m_base;} + }; +} + } // namesapce boost #endif /* BOOST_PROPERTY_HPP */ diff --git a/boost/pending/relaxed_heap.hpp b/boost/pending/relaxed_heap.hpp index b3ab2ed202..13f7af4c0e 100644 --- a/boost/pending/relaxed_heap.hpp +++ b/boost/pending/relaxed_heap.hpp @@ -163,7 +163,7 @@ public: void remove(const value_type& x) { group* a = &index_to_group[get(id, x) / log_n]; - assert(groups[get(id, x)] != 0); + assert(groups[get(id, x)]); a->value = x; a->kind = smallest_key; promote(a); |