|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70814 - trunk/boost/spirit/home/support
From: hartmut.kaiser_at_[hidden]
Date: 2011-04-01 07:43:37
Author: hkaiser
Date: 2011-04-01 07:43:37 EDT (Fri, 01 Apr 2011)
New Revision: 70814
URL: http://svn.boost.org/trac/boost/changeset/70814
Log:
Spirit: adding workaround for gcc 4.2.1
Text files modified:
trunk/boost/spirit/home/support/attributes.hpp | 94 +++++++++++++++++++++------------------
1 files changed, 50 insertions(+), 44 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 07:43:37 EDT (Fri, 01 Apr 2011)
@@ -101,8 +101,57 @@
///////////////////////////////////////////////////////////////////////////
// Find out if T can be a weak substitute for Expected attribute
+ namespace detail
+ {
+ template <typename T, typename Expected>
+ struct value_type_is_weak_substitute
+ : is_weak_substitute<
+ typename container_value<T>::type
+ , typename container_value<Expected>::type>
+ {};
+
+ template <typename T, typename Expected, typename Enable = void>
+ struct is_weak_substitute_impl : is_convertible<T, Expected> {};
+
+ template <typename T, typename Expected>
+ struct is_weak_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ is_container<T>,
+ is_container<Expected>,
+ value_type_is_weak_substitute<T, Expected> >
+ >::type>
+ : mpl::true_ {};
+
+ template <typename T, typename Expected>
+ struct is_weak_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ fusion::traits::is_sequence<T>,
+ fusion::traits::is_sequence<Expected>,
+ mpl::equal<T, Expected, is_weak_substitute<mpl::_1, mpl::_2> > >
+ >::type>
+ : mpl::true_ {};
+
+ // If this is not defined, the main template definition above will return
+ // true if T is convertible to the first type in a fusion::vector. We
+ // globally declare any non-Fusion sequence T as not compatible with any
+ // Fusion sequence Expected.
+ template <typename T, typename Expected>
+ struct is_weak_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ mpl::not_<fusion::traits::is_sequence<T> >
+ , fusion::traits::is_sequence<Expected> >
+ >::type>
+ : mpl::false_ {};
+ }
+
+ // main template forwards to detail namespace, this helps older compilers
+ // to disambiguate things
template <typename T, typename Expected, typename Enable /*= void*/>
- struct is_weak_substitute : is_convertible<T, Expected> {};
+ struct is_weak_substitute
+ : detail::is_weak_substitute_impl<T, Expected> {};
template <typename T, typename Expected>
struct is_weak_substitute<optional<T>, optional<Expected> >
@@ -116,49 +165,6 @@
struct is_weak_substitute<T, optional<Expected> >
: is_weak_substitute<T, Expected> {};
- template <typename T, typename Expected>
- struct is_weak_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- fusion::traits::is_sequence<T>,
- fusion::traits::is_sequence<Expected>,
- mpl::equal<T, Expected, is_weak_substitute<mpl::_1, mpl::_2> > >
- >::type>
- : mpl::true_ {};
-
- // If this is not defined, the main template definition above will return
- // true if T is convertible to the first type in a fusion::vector. We
- // globally declare any non-Fusion sequence T as not compatible with any
- // Fusion sequence Expected.
- template <typename T, typename Expected>
- struct is_weak_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- mpl::not_<fusion::traits::is_sequence<T> >
- , fusion::traits::is_sequence<Expected> >
- >::type>
- : mpl::false_ {};
-
- namespace detail
- {
- template <typename T, typename Expected>
- struct value_type_is_weak_substitute
- : is_weak_substitute<
- typename container_value<T>::type
- , typename container_value<Expected>::type>
- {};
- }
-
- template <typename T, typename Expected>
- struct is_weak_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- is_container<T>,
- is_container<Expected>,
- detail::value_type_is_weak_substitute<T, Expected> >
- >::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