Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70843 - trunk/boost/spirit/home/support
From: hartmut.kaiser_at_[hidden]
Date: 2011-04-01 22:55:22


Author: hkaiser
Date: 2011-04-01 22:55:22 EDT (Fri, 01 Apr 2011)
New Revision: 70843
URL: http://svn.boost.org/trac/boost/changeset/70843

Log:
Spirit: fixed yet another attribute handling problem
Text files modified:
   trunk/boost/spirit/home/support/attributes.hpp | 66 ++++++++++++++++++++++++---------------
   1 files changed, 40 insertions(+), 26 deletions(-)

Modified: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes.hpp (original)
+++ trunk/boost/spirit/home/support/attributes.hpp 2011-04-01 22:55:22 EDT (Fri, 01 Apr 2011)
@@ -60,24 +60,6 @@
 
     ///////////////////////////////////////////////////////////////////////////
     // Find out if T can be a (strong) substitute for Expected attribute
- template <typename T, typename Expected, typename Enable /*= void*/>
- struct is_substitute : is_same<T, Expected> {};
-
- template <typename T, typename Expected>
- struct is_substitute<optional<T>, optional<Expected> >
- : is_substitute<T, Expected> {};
-
- template <typename T, typename Expected>
- struct is_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- fusion::traits::is_sequence<T>,
- fusion::traits::is_sequence<Expected>,
- mpl::equal<T, Expected, is_substitute<mpl::_1, mpl::_2> >
- >
- >::type>
- : mpl::true_ {};
-
     namespace detail
     {
         template <typename T, typename Expected>
@@ -86,17 +68,44 @@
                 typename container_value<T>::type
               , typename container_value<Expected>::type>
         {};
+
+ template <typename T, typename Expected, typename Enable = void>
+ struct is_substitute_impl : is_same<T, Expected> {};
+
+ template <typename T, typename Expected>
+ struct is_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ fusion::traits::is_sequence<T>,
+ fusion::traits::is_sequence<Expected>,
+ mpl::equal<T, Expected, is_substitute<mpl::_1, mpl::_2> >
+ >
+ >::type>
+ : mpl::true_ {};
+
+ template <typename T, typename Expected>
+ struct is_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ is_container<T>,
+ is_container<Expected>,
+ detail::value_type_is_substitute<T, Expected>
+ >
+ >::type>
+ : mpl::true_ {};
     }
 
+ template <typename T, typename Expected, typename Enable /*= void*/>
+ struct is_substitute
+ : detail::is_substitute_impl<T, Expected> {};
+
     template <typename T, typename Expected>
- struct is_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- is_container<T>,
- is_container<Expected>,
- detail::value_type_is_substitute<T, Expected>
- >
- >::type>
+ struct is_substitute<optional<T>, optional<Expected> >
+ : is_substitute<T, Expected> {};
+
+ template <typename T>
+ struct is_substitute<T, T
+ , typename enable_if<not_is_optional<T> >::type>
       : mpl::true_ {};
 
     ///////////////////////////////////////////////////////////////////////////
@@ -165,6 +174,11 @@
     struct is_weak_substitute<T, optional<Expected> >
       : is_weak_substitute<T, Expected> {};
 
+ template <typename T>
+ struct is_weak_substitute<T, T
+ , typename enable_if<not_is_optional<T> >::type>
+ : mpl::true_ {};
+
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, typename Enable/* = void*/>
     struct is_proxy : mpl::false_ {};


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