Added support for &&, ||

[SVN r43269]
This commit is contained in:
Peter Dimov
2008-02-15 18:40:36 +00:00
parent e73f08edee
commit f1afd17717
3 changed files with 111 additions and 0 deletions
+26
View File
@@ -248,6 +248,9 @@ public:
}
};
struct logical_and;
struct logical_or;
template< class A1, class A2 > class list2: private storage2< A1, A2 >
{
private:
@@ -294,6 +297,26 @@ public:
unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
}
template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
{
return a[ base_type::a1_ ] && a[ base_type::a2_ ];
}
template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
{
return a[ base_type::a1_ ] && a[ base_type::a2_ ];
}
template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
{
return a[ base_type::a1_ ] || a[ base_type::a2_ ];
}
template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
{
return a[ base_type::a1_ ] || a[ base_type::a2_ ];
}
template<class V> void accept(V & v) const
{
base_type::accept(v);
@@ -1158,6 +1181,9 @@ BOOST_BIND_OPERATOR( <=, less_equal )
BOOST_BIND_OPERATOR( >, greater )
BOOST_BIND_OPERATOR( >=, greater_equal )
BOOST_BIND_OPERATOR( &&, logical_and )
BOOST_BIND_OPERATOR( ||, logical_or )
#undef BOOST_BIND_OPERATOR
#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)