[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Andriy Andreykiv |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Tue, 14 May 2019 05:26:42 -0400 (EDT) |
branch: c14_complience
commit 1de83096b5972146568c8562b6d3b3c418f37f22
Author: Andriy.Andreykiv <address@hidden>
Date: Tue May 14 11:23:55 2019 +0200
removing derivation of operators from public std::binary_function<T, T,
int>, which is deprecated in C++14 as well as replacing bind functions with
lambda's
---
src/getfem/bgeot_poly_composite.h | 5 ++---
src/getfem/bgeot_small_vector.h | 4 ++--
src/getfem/bgeot_sparse_tensors.h | 4 ++--
src/getfem/dal_tree_sorted.h | 3 +--
src/gmm/gmm_algobase.h | 45 +++++++++++++++++----------------------
5 files changed, 27 insertions(+), 34 deletions(-)
diff --git a/src/getfem/bgeot_poly_composite.h
b/src/getfem/bgeot_poly_composite.h
index 19eae27..5fb79af 100644
--- a/src/getfem/bgeot_poly_composite.h
+++ b/src/getfem/bgeot_poly_composite.h
@@ -52,15 +52,14 @@ namespace bgeot {
/// A comparison function for bgeot::base_node
struct imbricated_box_less
- : public std::binary_function<base_node, base_node, int>
- {
+ {
mutable int exp_max, exp_min;
mutable scalar_type c_max;
unsigned base;
/// comparaison function
int operator()(const base_node &x, const base_node &y) const;
-
+
imbricated_box_less(unsigned ba = 10, int emi = -15, int ema = -2) {
base = ba; exp_max = ema; exp_min = emi;
c_max = pow(double(base), double(-exp_max));
diff --git a/src/getfem/bgeot_small_vector.h b/src/getfem/bgeot_small_vector.h
index 12cd4fc..c909c90 100644
--- a/src/getfem/bgeot_small_vector.h
+++ b/src/getfem/bgeot_small_vector.h
@@ -236,7 +236,7 @@ namespace bgeot {
small_vector<T> operator-() const
{ return -1.*(*this); }
small_vector<T> operator*(T v) const
- { return small_vector<T>(*this, std::bind2nd(std::multiplies<T>(),v)); }
+ {return small_vector<T>(*this, [&v](const auto &x) {return v * x;});}
small_vector<T> operator/(T v) const { return (*this)*(T(1)/v); }
small_vector<T>& operator+=(const small_vector<T>& other) {
const_iterator b = other.begin(); iterator it = begin();
@@ -333,7 +333,7 @@ namespace bgeot {
{ return -1.*(*this); }
small_vector<T> operator*(T v) const
- { return small_vector<T>(*this, std::bind2nd(std::multiplies<T>(),v)); }
+ {return small_vector<T>(*this, [&v](const auto &x) {return v * x;});}
small_vector<T> operator/(T v) const { return (*this)*(T(1)/v); }
diff --git a/src/getfem/bgeot_sparse_tensors.h
b/src/getfem/bgeot_sparse_tensors.h
index 0f45e22..fa7aefe 100644
--- a/src/getfem/bgeot_sparse_tensors.h
+++ b/src/getfem/bgeot_sparse_tensors.h
@@ -174,8 +174,8 @@ namespace bgeot {
void unset_card() const { card_uptodate = false; }
index_type card(bool just_look=false) const {
if (!card_uptodate || just_look) {
- index_type c = index_type(std::count_if(m.begin(), m.end(),
- std::bind2nd(std::equal_to<bool>(),true)));
+ index_type c = index_type(std::count_if(m.begin(), m.end(),
+ [](const auto &x) {return x == true;}));
if (just_look) return c;
card_ = c;
}
diff --git a/src/getfem/dal_tree_sorted.h b/src/getfem/dal_tree_sorted.h
index 0ae6419..48745ee 100644
--- a/src/getfem/dal_tree_sorted.h
+++ b/src/getfem/dal_tree_sorted.h
@@ -736,8 +736,7 @@ namespace dal {
/* ********************************************************************* */
/* pas completement satisfaisant. A utiliser avec precautions. */
- template<typename T, typename TAB, typename COMP> struct less_index
- : public std::binary_function<size_t, size_t, int> {
+ template<typename T, typename TAB, typename COMP> struct less_index{
const TAB *tab;
COMP compare;
mutable const T *search_elt;
diff --git a/src/gmm/gmm_algobase.h b/src/gmm/gmm_algobase.h
index 64a859d..722fac0 100644
--- a/src/gmm/gmm_algobase.h
+++ b/src/gmm/gmm_algobase.h
@@ -49,39 +49,36 @@ namespace gmm {
/* ********************************************************************* */
template <class T>
- struct less : public std::binary_function<T, T, int> {
+ struct less {
inline int operator()(const T& x, const T& y) const
{ return (x < y) ? -1 : ((y < x) ? 1 : 0); }
};
- template<> struct less<int> : public std::binary_function<int, int, int>
- { int operator()(int x, int y) const { return x-y; } };
- template<> struct less<char> : public std::binary_function<char, char, int>
- { int operator()(char x, char y) const { return int(x-y); } };
- template<> struct less<short> : public std::binary_function<short,short,int>
- { int operator()(short x, short y) const { return int(x-y); } };
- template<> struct less<unsigned char>
- : public std::binary_function<unsigned char, unsigned char, int> {
+ template<> struct less<int> {
+ int operator()(int x, int y) const { return x-y; } };
+ template<> struct less<char> {
+ int operator()(char x, char y) const { return int(x-y); } };
+ template<> struct less<short> {
+ int operator()(short x, short y) const { return int(x-y); } };
+ template<> struct less<unsigned char> {
int operator()(unsigned char x, unsigned char y) const
{ return int(x)-int(y); }
};
template <class T>
- struct greater : public std::binary_function<T, T, int> {
+ struct greater {
inline int operator()(const T& x, const T& y) const
{ return (y < x) ? -1 : ((x < y) ? 1 : 0); }
};
- template<> struct greater<int> : public std::binary_function<int, int, int>
- { int operator()(int x, int y) const { return y-x; } };
- template<> struct greater<char> : public std::binary_function<char,char,int>
- { int operator()(char x, char y) const { return int(y-x); } };
- template<> struct greater<short>
- : public std::binary_function<short, short, int>
- { int operator()(short x, short y) const { return int(y-x); } };
- template<> struct greater<unsigned char>
- : public std::binary_function<unsigned char, unsigned char, int> {
+ template<> struct greater<int> {
+ int operator()(int x, int y) const { return y-x; } };
+ template<> struct greater<char> {
+ int operator()(char x, char y) const { return int(y-x); } };
+ template<> struct greater<short> {
+ int operator()(short x, short y) const { return int(y-x); } };
+ template<> struct greater<unsigned char> {
int operator()(unsigned char x, unsigned char y) const
{ return int(y)-int(x); }
};
@@ -89,7 +86,7 @@ namespace gmm {
template <typename T> inline T my_abs(T a) { return (a < T(0)) ? T(-a) : a; }
template <class T>
- struct approx_less : public std::binary_function<T, T, int> {
+ struct approx_less {
double eps;
inline int operator()(const T &x, const T &y) const
{ if (my_abs(x - y) <= eps) return 0; if (x < y) return -1; return 1; }
@@ -97,7 +94,7 @@ namespace gmm {
};
template <class T>
- struct approx_greater : public std::binary_function<T, T, int> {
+ struct approx_greater {
double eps;
inline int operator()(const T &x, const T &y) const
{ if (my_abs(x - y) <= eps) return 0; if (x > y) return -1; return 1; }
@@ -116,8 +113,7 @@ namespace gmm {
}
template<class CONT, class COMP = gmm::less<typename CONT::value_type> >
- struct lexicographical_less : public std::binary_function<CONT, CONT, int>
- {
+ struct lexicographical_less {
COMP c;
int operator()(const CONT &x, const CONT &y) const {
return gmm::lexicographical_compare(x.begin(), x.end(),
@@ -127,8 +123,7 @@ namespace gmm {
};
template<class CONT, class COMP = gmm::less<typename CONT::value_type> >
- struct lexicographical_greater
- : public std::binary_function<CONT, CONT, int> {
+ struct lexicographical_greater {
COMP c;
int operator()(const CONT &x, const CONT &y) const {
return -gmm::lexicographical_compare(x.begin(), x.end(),
- [Getfem-commits] [getfem-commits] branch c14_complience created (now 7b85d5c), Andriy Andreykiv, 2019/05/14
- [Getfem-commits] (no subject), Andriy Andreykiv, 2019/05/14
- [Getfem-commits] (no subject), Andriy Andreykiv, 2019/05/14
- [Getfem-commits] (no subject), Andriy Andreykiv, 2019/05/14
- [Getfem-commits] (no subject),
Andriy Andreykiv <=
- [Getfem-commits] (no subject), Andriy Andreykiv, 2019/05/14
- [Getfem-commits] (no subject), Andriy Andreykiv, 2019/05/14