]> www.ginac.de Git - ginac.git/commitdiff
[C++17] Remove inheritance from std::binary_function, std::unary_function.
authorRichard Kreckel <kreckel@ginac.de>
Fri, 29 Jan 2016 22:45:21 +0000 (23:45 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Fri, 29 Jan 2016 22:48:01 +0000 (23:48 +0100)
This inheritance is unneeded since C++11 and the two classes may be
removed in C++-17.

doc/tutorial/ginac.texi
ginac/clifford.cpp
ginac/ex.h
ginac/expair.h
ginac/hash_map.h
ginac/indexed.cpp
ginac/ptr.h
ginac/symmetry.cpp

index a8c537971edbfbdf0aceee5ad9c3988c726c7dd3..9af3d527096f4f0bdd4c8188fc4e2ab868b19fff 100644 (file)
@@ -4157,12 +4157,12 @@ provides two functors that can be supplied as proper binary comparison
 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;
 @};
@@ -4190,7 +4190,7 @@ std::sort(v.begin(), v.end(), ex_is_less());
 
 // 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
index ab40064ffd86588f1dc6514a17fd4e8c561be495..7ab99281e7db0909fb5cd178c01cf8f3bb06ea03 100644 (file)
@@ -340,7 +340,7 @@ static void base_and_index(const ex & c, ex & b, ex & i)
 }
 
 /** 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);
index 21df43059c645e886c7870c1078afaf70b6106e3..3b980aabafff98f9ae6bfe20c9b50b28ded03607 100644 (file)
@@ -673,19 +673,19 @@ inline bool are_ex_trivially_equal(const ex &e1, const ex &e2)
 }
 
 /* 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); }
 };
 
index b37fb165cf2257f0686977ea95d6b8aac2b3ebb5..443f20a96aea948bf1afec9850cf038b84482762 100644 (file)
@@ -92,7 +92,7 @@ public:
 };
 
 /** 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); }
 };
 
@@ -100,11 +100,11 @@ struct expair_is_less : public std::binary_function<expair, expair, bool> {
  *  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); }
 };
 
index 2616a28491a71c4e3e84eb20323ddf17e0e20bb3..6d334d7d8dafeebbc18792a5f0469dfda368cf00 100644 (file)
@@ -192,7 +192,7 @@ public:
        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
index 86af6811ba3752edb7caa3e174357acb3caff593..77c8eb5c9cc80298dc55fb29bffe194be8e15e2d 100644 (file)
@@ -394,7 +394,7 @@ ex indexed::derivative(const symbol & s) 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))
@@ -506,7 +506,7 @@ exvector ncmul::get_free_indices() const
        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);
@@ -719,7 +719,7 @@ next_index: ;
 }
 
 /* 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;
index 29db23501ead133f09d92fcd47c432bcbe7423d8..b7736c7c322d8d4f478b5ac69401b682b6e7e5df 100644 (file)
@@ -155,8 +155,7 @@ namespace std {
 
 /** 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);
index c8c27a03c1221c4463d3c8f84c477de691234ecf..614b11736136dea1b83ad1c1be93977c03122c09 100644 (file)
@@ -389,7 +389,7 @@ const symmetry & antisymmetric4()
        return ex_to<symmetry>(s);
 }
 
-class sy_is_less : public std::binary_function<ex, ex, bool> {
+class sy_is_less {
        exvector::iterator v;
 
 public:
@@ -413,7 +413,7 @@ public:
        }
 };
 
-class sy_swap : public std::binary_function<ex, ex, void> {
+class sy_swap {
        exvector::iterator v;
 
 public: