predicates to the STL:
@example
-class ex_is_less : public std::binary_function<ex, ex, bool> @{
+class ex_is_less @{
public:
bool operator()(const ex &lh, const ex &rh) const;
@};
-class ex_is_equal : public std::binary_function<ex, ex, bool> @{
+class ex_is_equal @{
public:
bool operator()(const ex &lh, const ex &rh) const;
@};
// count the number of expressions equal to '1'
unsigned num_ones = std::count_if(v.begin(), v.end(),
- std::bind2nd(ex_is_equal(), 1));
+ [](const ex& e) @{ return ex_is_equal()(e, 1); @});
@end example
The implementation of @code{ex_is_less} uses the member function
}
/** Predicate for finding non-clifford objects. */
-struct is_not_a_clifford : public std::unary_function<ex, bool> {
+struct is_not_a_clifford {
bool operator()(const ex & e)
{
return !is_a<clifford>(e);
}
/* Function objects for STL sort() etc. */
-struct ex_is_less : public std::binary_function<ex, ex, bool> {
+struct ex_is_less {
bool operator() (const ex &lh, const ex &rh) const { return lh.compare(rh) < 0; }
};
-struct ex_is_equal : public std::binary_function<ex, ex, bool> {
+struct ex_is_equal {
bool operator() (const ex &lh, const ex &rh) const { return lh.is_equal(rh); }
};
-struct op0_is_equal : public std::binary_function<ex, ex, bool> {
+struct op0_is_equal {
bool operator() (const ex &lh, const ex &rh) const { return lh.op(0).is_equal(rh.op(0)); }
};
-struct ex_swap : public std::binary_function<ex, ex, void> {
+struct ex_swap {
void operator() (ex &lh, ex &rh) const { lh.swap(rh); }
};
};
/** Function object for insertion into third argument of STL's sort() etc. */
-struct expair_is_less : public std::binary_function<expair, expair, bool> {
+struct expair_is_less {
bool operator()(const expair &lh, const expair &rh) const { return lh.is_less(rh); }
};
* into third argument of STL's sort(). Note that this does not define a
* strict weak ordering since for any symbol x we have neither 3*x<2*x or
* 2*x<3*x. Handle with care! */
-struct expair_rest_is_less : public std::binary_function<expair, expair, bool> {
+struct expair_rest_is_less {
bool operator()(const expair &lh, const expair &rh) const { return (lh.rest.compare(rh.rest)<0); }
};
-struct expair_swap : public std::binary_function<expair, expair, void> {
+struct expair_swap {
void operator()(expair &lh, expair &rh) const { lh.swap(rh); }
};
typedef typename Table::size_type size_type;
typedef typename Table::difference_type difference_type;
- class value_compare : public std::binary_function<value_type, value_type, bool>, private key_compare {
+ class value_compare : private key_compare {
friend class exhashmap;
public:
bool operator()(const value_type &lhs, const value_type &rhs) const
// global functions
//////////
-struct idx_is_equal_ignore_dim : public std::binary_function<ex, ex, bool> {
+struct idx_is_equal_ignore_dim {
bool operator() (const ex &lh, const ex &rh) const
{
if (lh.is_equal(rh))
return free_indices;
}
-struct is_summation_idx : public std::unary_function<ex, bool> {
+struct is_summation_idx {
bool operator()(const ex & e)
{
return is_dummy_pair(e, e);
}
/* Ordering that only compares the base expressions of indexed objects. */
-struct ex_base_is_less : public std::binary_function<ex, ex, bool> {
+struct ex_base_is_less {
bool operator() (const ex &lh, const ex &rh) const
{
return (is_a<indexed>(lh) ? lh.op(0) : lh).compare(is_a<indexed>(rh) ? rh.op(0) : rh) < 0;
/** Specialization of std::less for ptr<T> to enable ordering of ptr<T>
* objects (e.g. for the use as std::map keys). */
-template <class T> struct less<GiNaC::ptr<T>>
- : public binary_function<GiNaC::ptr<T>, GiNaC::ptr<T>, bool> {
+template <class T> struct less<GiNaC::ptr<T>> {
bool operator()(const GiNaC::ptr<T> &lhs, const GiNaC::ptr<T> &rhs) const
{
return less<T*>()(lhs.p, rhs.p);
return ex_to<symmetry>(s);
}
-class sy_is_less : public std::binary_function<ex, ex, bool> {
+class sy_is_less {
exvector::iterator v;
public:
}
};
-class sy_swap : public std::binary_function<ex, ex, void> {
+class sy_swap {
exvector::iterator v;
public: