Patch by Nathan Ridge to allow BOOST_FUSION_ADAPT_ADT adapted classes to be compared using relational operators.

[SVN r78490]
This commit is contained in:
Joel de Guzman
2012-05-17 01:10:20 +00:00
parent 51ade6529c
commit 8ce40ebd0c
9 changed files with 69 additions and 17 deletions

View File

@ -12,6 +12,7 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/support/as_const.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -32,7 +33,7 @@ namespace boost { namespace fusion { namespace detail
static bool
call(I1 const& a, I2 const& b, mpl::false_)
{
return *a == *b
return extension::as_const(*a) == extension::as_const(*b)
&& call(fusion::next(a), fusion::next(b));
}

View File

@ -12,6 +12,7 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/support/as_const.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
static bool
call(I1 const& a, I2 const& b, mpl::false_)
{
return *a > *b ||
(!(*b > *a) && call(fusion::next(a), fusion::next(b)));
return extension::as_const(*a) > extension::as_const(*b) ||
(!(extension::as_const(*b) > extension::as_const(*a)) &&
call(fusion::next(a), fusion::next(b)));
}
template <typename I1, typename I2>

View File

@ -12,6 +12,7 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/support/as_const.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
static bool
call(I1 const& a, I2 const& b, mpl::false_)
{
return *a >= *b
&& (!(*b >= *a) || call(fusion::next(a), fusion::next(b)));
return extension::as_const(*a) >= extension::as_const(*b)
&& (!(extension::as_const(*b) >= extension::as_const(*a)) ||
call(fusion::next(a), fusion::next(b)));
}
template <typename I1, typename I2>

View File

@ -12,6 +12,7 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/support/as_const.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
static bool
call(I1 const& a, I2 const& b, mpl::false_)
{
return *a < *b ||
(!(*b < *a) && call(fusion::next(a), fusion::next(b)));
return extension::as_const(*a) < extension::as_const(*b) ||
(!(extension::as_const(*b) < extension::as_const(*a)) &&
call(fusion::next(a), fusion::next(b)));
}
template <typename I1, typename I2>

View File

@ -12,6 +12,7 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/support/as_const.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
static bool
call(I1 const& a, I2 const& b, mpl::false_)
{
return *a <= *b
&& (!(*b <= *a) || call(fusion::next(a), fusion::next(b)));
return extension::as_const(*a) <= extension::as_const(*b)
&& (!(extension::as_const(*b) <= extension::as_const(*a)) ||
call(fusion::next(a), fusion::next(b)));
}
template <typename I1, typename I2>

View File

@ -12,6 +12,7 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/support/as_const.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -32,7 +33,7 @@ namespace boost { namespace fusion { namespace detail
static bool
call(I1 const& a, I2 const& b, mpl::false_)
{
return *a != *b
return extension::as_const(*a) != extension::as_const(*b)
|| call(fusion::next(a), fusion::next(b));
}