remove some boost::bind

This commit is contained in:
Sébastien Loriot 2020-11-10 19:21:21 +01:00
parent 3c90fd817f
commit 1e249afdb3
6 changed files with 43 additions and 69 deletions

View File

@ -26,7 +26,6 @@
#include <CGAL/internal/AABB_tree/Primitive_helper.h> #include <CGAL/internal/AABB_tree/Primitive_helper.h>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/bind.hpp>
/// \file AABB_traits.h /// \file AABB_traits.h
@ -274,13 +273,13 @@ public:
switch(Traits::longest_axis(bbox)) switch(Traits::longest_axis(bbox))
{ {
case AT::CGAL_AXIS_X: // sort along x case AT::CGAL_AXIS_X: // sort along x
std::nth_element(first, middle, beyond, boost::bind(Traits::less_x,_1,_2,m_traits)); std::nth_element(first, middle, beyond, [this](const Primitive& p1, const Primitive& p2){ return Traits::less_x(p1, p2, this->m_traits); });
break; break;
case AT::CGAL_AXIS_Y: // sort along y case AT::CGAL_AXIS_Y: // sort along y
std::nth_element(first, middle, beyond, boost::bind(Traits::less_y,_1,_2,m_traits)); std::nth_element(first, middle, beyond, [this](const Primitive& p1, const Primitive& p2){ return Traits::less_y(p1, p2, this->m_traits); });
break; break;
case AT::CGAL_AXIS_Z: // sort along z case AT::CGAL_AXIS_Z: // sort along z
std::nth_element(first, middle, beyond, boost::bind(Traits::less_z,_1,_2,m_traits)); std::nth_element(first, middle, beyond, [this](const Primitive& p1, const Primitive& p2){ return Traits::less_z(p1, p2, this->m_traits); });
break; break;
default: default:
CGAL_error(); CGAL_error();

View File

@ -23,7 +23,6 @@
#include <algorithm> #include <algorithm>
#include <numeric> #include <numeric>
#include <CGAL/Random_convex_set_traits_2.h> #include <CGAL/Random_convex_set_traits_2.h>
#include <boost/functional.hpp>
namespace CGAL { namespace CGAL {
@ -80,7 +79,7 @@ random_convex_set_2( std::size_t n,
points.begin(), points.begin(),
points.end(), points.end(),
points.begin(), points.begin(),
boost::bind2nd( Sum(), scale( centroid, FT( -1)))); [&centroid, &sum, &scale](const Point_2& p) { return sum(p, scale(centroid, FT( -1))); });
// sort them according to their direction's angle // sort them according to their direction's angle
// w.r.t. the positive x-axis: // w.r.t. the positive x-axis:
@ -102,8 +101,7 @@ random_convex_set_2( std::size_t n,
points.begin(), points.begin(),
points.end(), points.end(),
points.begin(), points.begin(),
boost::bind2nd( Sum(), sum( centroid, [&centroid, &sum, &scale](const Point_2& p) { return sum(p, scale(centroid, FT( -1))); });
scale( new_centroid, FT( -1)))));
// compute maximal coordinate: // compute maximal coordinate:
FT maxcoord( max_coordinate( FT maxcoord( max_coordinate(
@ -118,7 +116,7 @@ random_convex_set_2( std::size_t n,
points.begin(), points.begin(),
points.end(), points.end(),
o, o,
boost::bind2nd( Scale(), FT( pg.range()) / maxcoord)); [&pg, &maxcoord, &scale](const Point_2& p){ return scale(p, FT( pg.range()) / maxcoord); });
} // random_convex_set_2( n, o, pg, t) } // random_convex_set_2( n, o, pg, t)

View File

@ -18,7 +18,6 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/Optimisation/assertions.h>
#include <boost/bind.hpp>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <CGAL/Sorted_matrix_search_traits_adaptor.h> #include <CGAL/Sorted_matrix_search_traits_adaptor.h>
@ -254,10 +253,10 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
std::nth_element(active_cells.begin(), std::nth_element(active_cells.begin(),
active_cells.begin() + upper_median_rank, active_cells.begin() + upper_median_rank,
active_cells.end(), active_cells.end(),
boost::bind( [&t](const Cell& c1, const Cell& c2)
t.compare_strictly(), {
boost::bind(Cell_min<Cell>(), _1), return t.compare_strictly()(Cell_min<Cell>()(c1), Cell_min<Cell>()(c2));
boost::bind(Cell_min<Cell>(), _2))); });
Cell_iterator lower_median_cell = Cell_iterator lower_median_cell =
active_cells.begin() + upper_median_rank; active_cells.begin() + upper_median_rank;
@ -267,10 +266,10 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
std::nth_element(active_cells.begin(), std::nth_element(active_cells.begin(),
active_cells.begin() + lower_median_rank, active_cells.begin() + lower_median_rank,
active_cells.end(), active_cells.end(),
boost::bind( [&t, &ccd](const Cell& c1, const Cell& c2)
t.compare_strictly(), {
boost::bind(Cell_max< Cell >(ccd), _1), return t.compare_strictly()(Cell_max< Cell >(ccd)(c1), Cell_max< Cell >(ccd)(c2));
boost::bind(Cell_max< Cell >(ccd), _2))); });
Cell_iterator upper_median_cell = Cell_iterator upper_median_cell =
active_cells.begin() + lower_median_rank; active_cells.begin() + lower_median_rank;
@ -282,10 +281,10 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
lower_median_cell = lower_median_cell =
find_if(active_cells.begin(), find_if(active_cells.begin(),
active_cells.end(), active_cells.end(),
boost::bind( [&lower_median](const Cell& c)
equal_to< Value >(), {
lower_median, return equal_to< Value >()(lower_median, Cell_min< Cell >()(c));
boost::bind(Cell_min< Cell >(), _1))); });
CGAL_optimisation_assertion(lower_median_cell != active_cells.end()); CGAL_optimisation_assertion(lower_median_cell != active_cells.end());
// ------------------------------------------------------ // ------------------------------------------------------
// test feasibility of medians and remove cells accordingly: // test feasibility of medians and remove cells accordingly:
@ -318,10 +317,10 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
remove_if( remove_if(
active_cells.begin() + 1, active_cells.begin() + 1,
active_cells.end(), active_cells.end(),
boost::bind( [&t, &min_median](const Cell& c)
t.compare_non_strictly(), {
min_median, return t.compare_non_strictly()(min_median, Cell_min< Cell >()(c));
boost::bind(Cell_min< Cell >(), _1))); });
} // lower_median and upper_median are feasible } // lower_median and upper_median are feasible
else { // lower_median is feasible, but upper_median is not else { // lower_median is feasible, but upper_median is not
@ -337,16 +336,11 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
remove_if( remove_if(
active_cells.begin() + 1, active_cells.begin() + 1,
active_cells.end(), active_cells.end(),
boost::bind( [&t, &lower_median, &upper_median, &ccd](const Cell& c)
logical_or< bool >(), {
boost::bind( return t.compare_non_strictly()(lower_median, Cell_min< Cell >()(c)) ||
t.compare_non_strictly(), t.compare_non_strictly()(Cell_max< Cell >(ccd)(c), upper_median);
lower_median, });
boost::bind(Cell_min< Cell >(), _1)),
boost::bind(
t.compare_non_strictly(),
boost::bind(Cell_max< Cell >( ccd), _1),
upper_median)));
} // lower_median is feasible, but upper_median is not } // lower_median is feasible, but upper_median is not
else else
@ -364,16 +358,11 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
remove_if( remove_if(
active_cells.begin() + 1, active_cells.begin() + 1,
active_cells.end(), active_cells.end(),
boost::bind( [&t, &lower_median, &upper_median, &ccd](const Cell& c)
logical_or< bool >(), {
boost::bind( return t.compare_non_strictly()(upper_median, Cell_min<Cell>()(c)) ||
t.compare_non_strictly(), t.compare_non_strictly()(Cell_max<Cell>(ccd)(c),lower_median);
upper_median, });
boost::bind(Cell_min< Cell >(), _1)),
boost::bind(
t.compare_non_strictly(),
boost::bind(Cell_max< Cell >( ccd), _1),
lower_median)));
} // upper_median is feasible, but lower_median is not } // upper_median is feasible, but lower_median is not
else { // both upper_median and lower_median are infeasible else { // both upper_median and lower_median are infeasible
@ -385,11 +374,11 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
remove_if( remove_if(
active_cells.begin(), active_cells.begin(),
active_cells.end(), active_cells.end(),
boost::bind( [&t, &ccd, &lower_median, &upper_median](const Cell& c)
t.compare_non_strictly(), {
boost::bind(Cell_max< Cell >( ccd), _1), return t.compare_non_strictly()(Cell_max<Cell>( ccd)(c),
max BOOST_PREVENT_MACRO_SUBSTITUTION ( lower_median, upper_median))); max BOOST_PREVENT_MACRO_SUBSTITUTION ( lower_median, upper_median));
});
} // both upper_median and lower_median are infeasible } // both upper_median and lower_median are infeasible
active_cells.erase( new_end, active_cells.end()); active_cells.erase( new_end, active_cells.end());

View File

@ -16,6 +16,8 @@
#include <vector> #include <vector>
#include <cstdlib> #include <cstdlib>
#include <boost/bind.hpp>
template < class Matrix_iterator, class Value > template < class Matrix_iterator, class Value >
Value Value
compute_upper_bound( Matrix_iterator f, compute_upper_bound( Matrix_iterator f,

View File

@ -17,7 +17,6 @@
#include <CGAL/Real_timer.h> #include <CGAL/Real_timer.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
#include <boost/bind.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#if BOOST_VERSION == 106000 #if BOOST_VERSION == 106000
@ -2018,12 +2017,12 @@ bool Straight_skeleton_builder_2<Gt,Ss,V>::FinishUp()
std::for_each( mSplitNodes.begin() std::for_each( mSplitNodes.begin()
,mSplitNodes.end () ,mSplitNodes.end ()
,boost::bind(&Straight_skeleton_builder_2<Gt,Ss,V>::MergeSplitNodes,this,_1) ,[this](Vertex_handle_pair p){ this->MergeSplitNodes(p); }
) ; ) ;
std::for_each( mDanglingBisectors.begin() std::for_each( mDanglingBisectors.begin()
,mDanglingBisectors.end () ,mDanglingBisectors.end ()
,boost::bind(&Straight_skeleton_builder_2<Gt,Ss,V>::EraseBisector,this,_1) ,[this](Halfedge_handle db){ this->EraseBisector(db); }
) ; ) ;
// MergeCoincidentNodes() locks all extremities of halfedges that have a vertex involved in a multinode. // MergeCoincidentNodes() locks all extremities of halfedges that have a vertex involved in a multinode.

View File

@ -53,7 +53,6 @@
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
#include <CGAL/Spatial_lock_grid_3.h> #include <CGAL/Spatial_lock_grid_3.h>
#include <boost/bind.hpp>
#include <boost/random/linear_congruential.hpp> #include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_smallint.hpp> #include <boost/random/uniform_smallint.hpp>
#include <boost/random/variate_generator.hpp> #include <boost/random/variate_generator.hpp>
@ -7294,22 +7293,10 @@ operator==(const Triangulation_3<GT, Tds1, Lds>& t1,
std::vector<Point> V2 (t2.points_begin(), t2.points_end()); std::vector<Point> V2 (t2.points_begin(), t2.points_end());
std::sort(V1.begin(), V1.end(), std::sort(V1.begin(), V1.end(),
boost::bind<Comparison_result>( [&cmp1, &cp](const Point& p1, const Point& p2){ return cmp1(cp(p1), cp(p2))==SMALLER; });
cmp1,
boost::bind<
typename boost::result_of<const Construct_point_3(const Point&)>::type>(cp, _1),
boost::bind<
typename boost::result_of<const Construct_point_3(const Point&)>::type>(cp, _2))
== SMALLER);
std::sort(V2.begin(), V2.end(), std::sort(V2.begin(), V2.end(),
boost::bind<Comparison_result>( [&cmp2, &cp](const Point& p1, const Point& p2){ return cmp2(cp(p1), cp(p2))==SMALLER; });
cmp2,
boost::bind<
typename boost::result_of<const Construct_point_3(const Point&)>::type>(cp, _1),
boost::bind<
typename boost::result_of<const Construct_point_3(const Point&)>::type>(cp, _2))
== SMALLER);
return V1 == V2; return V1 == V2;
} }