#ifndef BOOST_PHOENIX_FUNCTION_LAZY_OPERATOR
#define BOOST_PHOENIX_FUNCTION_LAZY_OPERATOR
#include <cmath>
#include <cstdlib>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
#include <boost/function.hpp>
namespace boost {
namespace phoenix {
struct a_unique_type_for_nil {
bool operator==( a_unique_type_for_nil ) const { return true; }
bool operator< ( a_unique_type_for_nil ) const { return false; }
typedef a_unique_type_for_nil value_type;
};
a_unique_type_for_nil NIL;
#ifndef BOOST_PHOENIX_NO_LAZY_EXCEPTIONS
struct lazy_exception : public std::exception {
const char* s;
lazy_exception( const char* ss ) : s(ss) {}
const char* what() const throw() { return s; }
};
#endif
typedef unsigned int RefCountType;
namespace impl {
template <class T>
struct remove_RC
{
typedef typename boost::remove_reference<T>::type TT;
typedef typename boost::remove_const<TT>::type type;
};
struct XId
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
: boost::remove_reference<A0>
{};
template <typename A0>
A0 operator()(A0 const & a0) const
{
return a0;
}
};
}
typedef boost::phoenix::function<impl::XId> Id;
Id id;
#ifdef BOOST_RESULT_OF_USE_TR1
namespace result_of {
template <
typename Arg1
, typename Arg2
>
class make_pair
{
public:
typedef typename impl::remove_RC<Arg1>::type Arg1Type;
typedef typename impl::remove_RC<Arg2>::type Arg2Type;
typedef std::pair<Arg1Type,Arg2Type> type;
typedef std::pair<Arg1Type,Arg2Type> result_type;
};
}
#endif
namespace impl
{
struct XMake_pair {
#ifdef BOOST_RESULT_OF_USE_TR1
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
{
typedef typename result_of::make_pair<A0,A1>::type type;
};
#else
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<std::pair<A0, A1> >
{};
#endif
template <typename A0, typename A1>
#ifdef BOOST_RESULT_OF_USE_TR1
typename result<XMake_pair(A0,A1)>::type
#else
std::pair<A0, A1>
#endif
operator()(A0 const & a0, A1 const & a1) const
{
return std::make_pair(a0,a1);
}
};
}
typedef boost::phoenix::function<impl::XMake_pair> Make_pair;
Make_pair make_pair;
namespace impl
{
struct XPlus
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename This, typename A0, typename A1, typename A2>
struct result<This(A0, A1, A2)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
return a0 + a1;
}
template <typename A0, typename A1, typename A2>
A0 operator()(A0 const & a0, A1 const & a1, A2 const & a2) const
{
return a0 + a1 + a2;
}
};
struct XMinus
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
return a0 - a1;
}
};
struct XMultiplies
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
return a0 * a1;
}
};
struct XDivides
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
return a0 / a1;
}
};
struct XModulus
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
return a0 % a1;
}
};
struct XNegate
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
: boost::remove_reference<A0>
{};
template <typename A0>
A0 operator()(A0 const & a0) const
{
return -a0;
}
};
struct XEqual
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 == a1;
}
};
struct XNot_equal
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 != a1;
}
};
struct XGreater
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 > a1;
}
};
struct XLess
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 < a1;
}
};
struct XGreater_equal
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 >= a1;
}
};
struct XLess_equal
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 <= a1;
}
};
struct XPositive
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
{
typedef bool type;
};
template <typename A0>
bool operator()(A0 const & a0) const
{
return a0 >= A0(0);
}
};
struct XLogical_and
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 && a1;
}
};
struct XLogical_or
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0,A1)>
{
typedef bool type;
};
template <typename A0, typename A1>
bool operator()(A0 const & a0, A1 const & a1) const
{
return a0 || a1;
}
};
struct XLogical_not
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
{
typedef bool type;
};
template <typename A0>
bool operator()(A0 const & a0) const
{
return !a0;
}
};
struct XMin
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
if ( a0 < a1 ) return a0; else return a1;
}
};
struct XMax
{
template <typename Sig>
struct result;
template <typename This, typename A0, typename A1>
struct result<This(A0, A1)>
: boost::remove_reference<A0>
{};
template <typename A0, typename A1>
A0 operator()(A0 const & a0, A1 const & a1) const
{
if ( a0 < a1 ) return a1; else return a0;
}
};
struct XInc
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
: boost::remove_reference<A0>
{};
template <typename A0>
A0 operator()(A0 const & a0) const
{
return a0 + 1;
}
};
struct XDec
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
: boost::remove_reference<A0>
{};
template <typename A0>
A0 operator()(A0 const & a0) const
{
return a0 - 1;
}
};
struct XSin
{
template <typename Sig>
struct result;
template <typename This, typename A0>
struct result<This(A0)>
: boost::remove_reference<A0>
{};
template <typename A0>
A0 operator()(A0 const & a0) const
{
return std::sin(a0);
}
};
template <typename Result>
struct what {
typedef Result result_type;
Result operator()(Result const & r) const
{
return r;
}
};
template <typename Result>
struct what0 {
typedef Result result_type;
Result operator()() const
{
return Result(100);
}
};
template <class Result, class F>
class MonomorphicWrapper0
{
F f;
public:
typedef Result result_type;
MonomorphicWrapper0( const F& g ) : f(g) {}
Result operator()() const {
return f();
}
};
}
boost::function1<int, int > what_int = impl::what<int>();
typedef boost::function1<int,int> fun1_int_int;
typedef boost::function0<int> fun0_int;
boost::function0<int> what0_int = impl::what0<int>();
BOOST_PHOENIX_ADAPT_FUNCTION(int,what,what_int,1)
BOOST_PHOENIX_ADAPT_FUNCTION_NULLARY(int,what0,what0_int)
typedef boost::phoenix::function<fun1_int_int> What_arg;
typedef boost::phoenix::function<fun0_int> What0_arg;
What_arg what_arg(what_int);
What0_arg what0_arg(what0_int);
typedef boost::phoenix::function<impl::XPlus> Plus;
typedef boost::phoenix::function<impl::XMinus> Minus;
typedef boost::phoenix::function<impl::XMultiplies> Multiplies;
typedef boost::phoenix::function<impl::XDivides> Divides;
typedef boost::phoenix::function<impl::XModulus> Modulus;
typedef boost::phoenix::function<impl::XNegate> Negate;
typedef boost::phoenix::function<impl::XEqual> Equal;
typedef boost::phoenix::function<impl::XNot_equal> Not_equal;
typedef boost::phoenix::function<impl::XGreater> Greater;
typedef boost::phoenix::function<impl::XLess> Less;
typedef boost::phoenix::function<impl::XGreater_equal> Greater_equal;
typedef boost::phoenix::function<impl::XLess_equal> Less_equal;
typedef boost::phoenix::function<impl::XPositive> Positive;
typedef boost::phoenix::function<impl::XLogical_and> Logical_and;
typedef boost::phoenix::function<impl::XLogical_or> Logical_or;
typedef boost::phoenix::function<impl::XLogical_not> Logical_not;
typedef boost::phoenix::function<impl::XMax> Max;
typedef boost::phoenix::function<impl::XMin> Min;
typedef boost::phoenix::function<impl::XInc> Inc;
typedef boost::phoenix::function<impl::XDec> Dec;
typedef boost::phoenix::function<impl::XSin> Sin;
Plus plus;
Minus minus;
Multiplies multiplies;
Divides divides;
Modulus modulus;
Negate negate;
Equal equal;
Not_equal not_equal;
Greater greater;
Less less;
Greater_equal greater_equal;
Less_equal less_equal;
Positive positive;
Logical_and logical_and;
Logical_or logical_or;
Logical_not logical_not;
Max max;
Min min;
Inc inc;
Dec dec;
Sin sin;
}
}
#endif