|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63942 - in trunk/boost/spirit/home: karma/nonterminal qi/nonterminal
From: hartmut.kaiser_at_[hidden]
Date: 2010-07-12 21:41:59
Author: hkaiser
Date: 2010-07-12 21:41:59 EDT (Mon, 12 Jul 2010)
New Revision: 63942
URL: http://svn.boost.org/trac/boost/changeset/63942
Log:
Spirit: improving compatibility with VC7.1
Text files modified:
trunk/boost/spirit/home/karma/nonterminal/rule.hpp | 47 +++++++++++++++++++++++++++++++++++++++
trunk/boost/spirit/home/qi/nonterminal/rule.hpp | 47 +++++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 2 deletions(-)
Modified: trunk/boost/spirit/home/karma/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/karma/nonterminal/rule.hpp 2010-07-12 21:41:59 EDT (Mon, 12 Jul 2010)
@@ -12,12 +12,12 @@
#endif
#include <boost/assert.hpp>
+#include <boost/config.hpp>
#include <boost/function.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_same.hpp>
-#include <boost/utility/enable_if.hpp>
#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/include/size.hpp>
@@ -211,6 +211,8 @@
return *this;
}
+// VC7.1 has problems to resolve 'rule' without explicit template parameters
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
// g++ 3.3 barfs if this is a member function :(
template <typename Expr>
friend rule& operator%=(rule& r, Expr const& expr)
@@ -231,6 +233,20 @@
{
return r %= static_cast<Expr const&>(expr);
}
+#else
+ // both friend functions have to be defined out of class as VC7.1
+ // will complain otherwise
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ friend rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>&r, Expr const& expr);
+
+ // non-const version needed to suppress proto's %= kicking in
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ friend rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr& expr);
+#endif
template <typename Context, typename Unused>
struct attribute
@@ -342,6 +358,35 @@
function_type f;
};
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>&r, Expr const& expr)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here, then
+ // the expression (expr) is not a valid spirit karma expression.
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
+
+ typedef typename
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>::encoding_modifier_type
+ encoding_modifier_type;
+
+ r.f = detail::bind_generator<mpl::true_>(
+ compile<karma::domain>(expr, encoding_modifier_type()));
+ return r;
+ }
+
+ // non-const version needed to suppress proto's %= kicking in
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr& expr)
+ {
+ return r %= static_cast<Expr const&>(expr);
+ }
+#endif
}}}
#if defined(BOOST_MSVC)
Modified: trunk/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/rule.hpp 2010-07-12 21:41:59 EDT (Mon, 12 Jul 2010)
@@ -12,11 +12,11 @@
#endif
#include <boost/assert.hpp>
+#include <boost/config.hpp>
#include <boost/function.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_same.hpp>
-#include <boost/utility/enable_if.hpp>
#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/include/size.hpp>
@@ -203,6 +203,8 @@
return *this;
}
+// VC7.1 has problems to resolve 'rule' without explicit template parameters
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
// g++ 3.3 barfs if this is a member function :(
template <typename Expr>
friend rule& operator%=(rule& r, Expr const& expr)
@@ -223,6 +225,20 @@
{
return r %= static_cast<Expr const&>(expr);
}
+#else
+ // both friend functions have to be defined out of class as VC7.1
+ // will complain otherwise
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ friend rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr const& expr);
+
+ // non-const version needed to suppress proto's %= kicking in
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ friend rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr& expr);
+#endif
template <typename Context, typename Iterator_>
struct attribute
@@ -346,6 +362,35 @@
std::string name_;
function_type f;
};
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ template <typename OutputIterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr const& expr)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (expr) is not a valid spirit qi expression.
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
+
+ typedef typename
+ rule<OutputIterator_, T1_, T2_, T3_, T4_>::encoding_modifier_type
+ encoding_modifier_type;
+
+ r.f = detail::bind_parser<mpl::true_>(
+ compile<qi::domain>(expr, encoding_modifier_type()));
+ return r;
+ }
+
+ template <typename Iterator_, typename T1_, typename T2_
+ , typename T3_, typename T4_, typename Expr>
+ rule<Iterator_, T1_, T2_, T3_, T4_>& operator%=(
+ rule<Iterator_, T1_, T2_, T3_, T4_>& r, Expr& expr)
+ {
+ return r %= static_cast<Expr const&>(expr);
+ }
+#endif
}}}
#if defined(BOOST_MSVC)
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