41#include "psort/MersenneTwister.h"
45template<
typename T1,
typename T2>
49 return lhs.first ==
rhs.first;
56struct myset:
public std::unary_function<T, T>
69struct identity :
public std::unary_function<T, T>
92struct totality :
public std::unary_function<T, bool>
107 T inf = std::numeric_limits<T>::max();
108 return (
x == 0) ?
inf:(1/
x);
114struct sel2nd:
public std::binary_function<T, T, T>
122template<
typename T1,
typename T2>
140struct exponentiate :
public std::binary_function<double, double, double>
154struct maximum :
public std::binary_function<T, T, T>
172struct minimum :
public std::binary_function<T, T, T>
190 return (
M.
rand() < 0.5)?
x :
y;
273 return (
x ||
y) && !(
x &&
y);
With 50/50 chances, return a one of the operants.
const T operator()(const T &x, const T &y)
Returns a special value (passed to the constructor of the functor) when both operants disagree.
const T operator()(const T &x, const T &y)
bool operator()(const T1 &x, const T2 &y) const
Compute the bitwise AND of two integral values.
T operator()(const T &x, const T &y) const
Compute the bitwise OR of two integral values.
T operator()(const T &x, const T &y) const
Compute the bitwise exclusive OR of two integral values.
T operator()(const T &x, const T &y) const
bool operator()(std::pair< T1, T2 > &lhs, std::pair< T1, T2 > &rhs)
double operator()(double x, double y) const
const T operator()(const T &x) const
Compute the logical exclusive OR of two integral values.
T operator()(const T &x, const T &y) const
Compute the maximum of two values.
const T operator()(const T &x, const T &y) const
Compute the minimum of two values.
const T operator()(const T &x, const T &y) const
const T operator()(const T &x) const
const T & operator()(const T &x) const
const T operator()(const T &x) const
const T & operator()(const T &x, const T &y) const
bool operator()(const T &x) const