From ab164923892b4d11d043ea3caa5311db55844cbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20DAVID?= Date: Wed, 6 Nov 2019 11:41:26 +0100 Subject: [PATCH] Remove the deprecated (c++11) bind1st and bind2nd Change-Id: I20e656d1d15596c34350ca51a1ebdbd6abdd4f63 --- scilab/modules/ast/includes/types/sparseOp.hxx | 14 +++++++------- scilab/modules/ast/src/cpp/types/sparse.cpp | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scilab/modules/ast/includes/types/sparseOp.hxx b/scilab/modules/ast/includes/types/sparseOp.hxx index a4d2295..ce5065f 100644 --- a/scilab/modules/ast/includes/types/sparseOp.hxx +++ b/scilab/modules/ast/includes/types/sparseOp.hxx @@ -169,7 +169,7 @@ Eigen::SparseMatrix* scalarOp(Eigen:: result_t* res; if (op(Scalar1(), op2) == result_scalar()) { - res = new result_t(op1.derived().unaryExpr(std::bind2nd(op, op2))); + res = new result_t(op1.derived().unaryExpr(std::bind(op, std::placeholders::_1, op2))); res->prune(&keepForSparse); } else @@ -178,7 +178,7 @@ Eigen::SparseMatrix* scalarOp(Eigen:: matrix hence the need for a dense tmp :( */ // TODO remove dense temp when Eigen provides sparse full traversal API Eigen::Matrix tmp(op1); - res = new result_t(tmp.unaryExpr(std::bind2nd(op, op2)).sparseView()); + res = new result_t(tmp.unaryExpr(std::bind(op, std::placeholders::_1, op2)).sparseView()); } return res; } @@ -199,14 +199,14 @@ Eigen::SparseMatrix* scalarOp(Scalar1 result_t* res; if (op(op1, Scalar2()) == result_scalar()) { - res = new result_t(op2.derived().unaryExpr(std::bind1st(op, op1))); + res = new result_t(op2.derived().unaryExpr(std::bind(op, op1, std::placeholders::_1))); res->prune(&keepForSparse); } else { // TODO remove dense temp when Eigen provides sparse full traversal API Eigen::Matrix tmp(op2); - res = new result_t(tmp.unaryExpr(std::bind1st(op, op1)).sparseView()); + res = new result_t(tmp.unaryExpr(std::bind(op, op1, std::placeholders::_1)).sparseView()); } return res; } @@ -219,7 +219,7 @@ Eigen::SparseMatrix* scalarOp(Scalar1 * @param op binary operation to perform * @return ptr to the new Eigen::Sparse result containing the cwise binary op with the two matrices. */ -template< typename Sp1, typename Sp2 , typename Op> +template< typename Sp1, typename Sp2, typename Op> Eigen::SparseMatrix* cwiseOp(Eigen::EigenBase const& op1, Eigen::EigenBase const& op2, Op op) { if (op1.rows() == 1 && op1.cols() == 1) @@ -241,7 +241,7 @@ Eigen::SparseMatrix* cwiseOp(Eigen::E * @param op binary operation to perform * @return ptr to the new Eigen::Sparse result containing the cwise binary op between the two matrices */ -template< typename Sp1, typename Sp2 , typename Op> +template< typename Sp1, typename Sp2, typename Op> Eigen::SparseMatrix* cwiseOp(Eigen::EigenBase const& op1, Eigen::EigenBase const& op2, Op op, FullTraversal /*unused*/) { typedef typename Op::result_type result_scalar; @@ -263,7 +263,7 @@ Eigen::SparseMatrix* cwiseOp(Eigen::E * @param op binary operation to perform * @return ptr to the new Eigen::Sparse result containing the cwise binary op with the scalar. */ -template< typename Sp1, typename Sp2 , typename Op> +template< typename Sp1, typename Sp2, typename Op> Eigen::SparseMatrix* cwiseOp(Eigen::EigenBase const& op1, Eigen::EigenBase const& op2, Op op, UnionTraversal /*unused*/) { typedef typename Op::result_type result_scalar; diff --git a/scilab/modules/ast/src/cpp/types/sparse.cpp b/scilab/modules/ast/src/cpp/types/sparse.cpp index 1243fd4..cb020c1 100644 --- a/scilab/modules/ast/src/cpp/types/sparse.cpp +++ b/scilab/modules/ast/src/cpp/types/sparse.cpp @@ -522,7 +522,7 @@ Sparse::Sparse(int rows, int cols, int nonzeros, int* inner, int* outer, double* bool Sparse::getMemory(long long *_piSize, long long* _piSizePlusType) { - *_piSize = nonZeros()*sizeof(double)*(isComplex() ? 2 : 1); + *_piSize = nonZeros() * sizeof(double) * (isComplex() ? 2 : 1); *_piSizePlusType = *_piSize + sizeof(*this); return true; } @@ -2660,7 +2660,7 @@ double* Sparse::outputCols(double* out) const mycopy_n(matrixReal->innerIndexPtr(), nonZeros(), out); } - return std::transform(out, out, out, std::bind2nd(std::plus(), 1)); + return std::transform(out, out, out, std::bind(std::plus(), std::placeholders::_1, 1)); } @@ -3229,7 +3229,7 @@ SparseBool::SparseBool(int rows, int cols, int trues, int* inner, int* outer) bool SparseBool::getMemory(long long *_piSize, long long* _piSizePlusType) { - *_piSize = nbTrue()*sizeof(bool); + *_piSize = nbTrue() * sizeof(bool); *_piSizePlusType = *_piSize + sizeof(*this); return true; } -- 1.7.9.5