|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80885 - trunk/boost/accumulators/framework
From: eric_at_[hidden]
Date: 2012-10-06 13:17:12
Author: eric_niebler
Date: 2012-10-06 13:17:11 EDT (Sat, 06 Oct 2012)
New Revision: 80885
URL: http://svn.boost.org/trac/boost/changeset/80885
Log:
fix long-standing dependency tracking bug, refs #7409
Text files modified:
trunk/boost/accumulators/framework/depends_on.hpp | 41 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 2 deletions(-)
Modified: trunk/boost/accumulators/framework/depends_on.hpp
==============================================================================
--- trunk/boost/accumulators/framework/depends_on.hpp (original)
+++ trunk/boost/accumulators/framework/depends_on.hpp 2012-10-06 13:17:11 EDT (Sat, 06 Oct 2012)
@@ -11,6 +11,8 @@
#include <boost/version.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/map.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/copy.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/sort.hpp>
@@ -26,6 +28,7 @@
#include <boost/mpl/is_sequence.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/insert_range.hpp>
+#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/transform_view.hpp>
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
@@ -94,15 +97,49 @@
template<typename A, typename B>
struct is_dependent_on
: is_base_and_derived<
- typename undroppable<B>::type
+ typename feature_of<typename undroppable<B>::type>::type
, typename undroppable<A>::type
>
{};
+ template<typename Feature>
+ struct dependencies_of
+ {
+ typedef typename Feature::dependencies type;
+ };
+
+ // Should use mpl::insert_range, but doesn't seem to work with mpl sets
+ template<typename Set, typename Range>
+ struct set_insert_range
+ : mpl::fold<
+ Range
+ , Set
+ , mpl::insert<mpl::_1, mpl::_2>
+ >
+ {};
+
+ template<typename Features>
+ struct collect_abstract_features
+ : mpl::fold<
+ Features
+ , mpl::set0<>
+ , set_insert_range<
+ mpl::insert<mpl::_1, feature_of<mpl::_2> >
+ , collect_abstract_features<dependencies_of<mpl::_2> >
+ >
+ >
+ {};
+
template<typename Features>
struct depends_on_base
: mpl::inherit_linearly<
- typename mpl::sort<Features, is_dependent_on<mpl::_1, mpl::_2> >::type
+ typename mpl::sort<
+ typename mpl::copy<
+ typename collect_abstract_features<Features>::type
+ , mpl::back_inserter<mpl::vector0<> >
+ >::type
+ , is_dependent_on<mpl::_1, mpl::_2>
+ >::type
// Don't inherit multiply from a feature
, mpl::if_<
is_dependent_on<mpl::_1, mpl::_2>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk