Skip to content

Remove Boost.Bind usages. #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ target_link_libraries(boost_graph
Boost::array
Boost::assert
Boost::bimap
Boost::bind
Boost::concept_check
Boost::config
Boost::container_hash
Expand Down
20 changes: 8 additions & 12 deletions include/boost/graph/howard_cycle_ratio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <functional>
#include <limits>

#include <boost/bind/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
Expand Down Expand Up @@ -241,14 +240,10 @@ namespace detail
typename graph_traits< Graph >::out_edge_iterator oei, oeie;
for (boost::tie(vi, vie) = vertices(m_g); vi != vie; ++vi)
{
using namespace boost::placeholders;

boost::tie(oei, oeie) = out_edges(*vi, m_g);
typename graph_traits< Graph >::out_edge_iterator mei
= boost::first_max_element(oei, oeie,
boost::bind(m_cmp,
boost::bind(&EdgeWeight1::operator[], m_ew1m, _1),
boost::bind(&EdgeWeight1::operator[], m_ew1m, _2)));
auto mei = boost::first_max_element(oei, oeie,
[this](const auto& first, const auto& second)
{ return m_cmp(m_ew1m[first], m_ew1m[second]); });
if (mei == oeie)
{
if (m_sink == graph_traits< Graph >().null_vertex())
Expand Down Expand Up @@ -356,16 +351,17 @@ namespace detail
*/
float_t policy_mcr()
{
using namespace boost::placeholders;

std::fill(m_col_bfs.begin(), m_col_bfs.end(), my_white);
color_map_t vcm_ = color_map_t(m_col_bfs.begin(), m_vim);
typename graph_traits< Graph >::vertex_iterator uv_itr, vie;
boost::tie(uv_itr, vie) = vertices(m_g);
float_t mcr = m_bound;
while ((uv_itr = std::find_if(uv_itr, vie,
boost::bind(std::equal_to< my_color_type >(), my_white,
boost::bind(&color_map_t::operator[], vcm_, _1))))
[this, &vcm_](const auto& uv)
{
return std::equal_to< my_color_type >()(
my_white, vcm_[uv]);
}))
!= vie)
/// While there are undiscovered vertices
{
Expand Down
5 changes: 1 addition & 4 deletions include/boost/graph/king_ordering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <vector>
#include <algorithm>
#include <boost/config.hpp>
#include <boost/bind/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/graph/detail/sparse_ordering.hpp>
#include <boost/graph/graph_utility.hpp>
Expand Down Expand Up @@ -49,8 +48,6 @@ namespace detail
template < typename Vertex, typename Graph >
void finish_vertex(Vertex, Graph& g)
{
using namespace boost::placeholders;

typename graph_traits< Graph >::out_edge_iterator ei, ei_end;
Vertex v, w;

Expand All @@ -61,7 +58,7 @@ namespace detail
reverse_iterator rbegin = Qptr->rbegin();

// heap the vertices already there
std::make_heap(rbegin, rend, boost::bind< bool >(comp, _2, _1));
std::make_heap(rbegin, rend, [this](const auto& first, const auto& second) { return comp(second, first); });

unsigned i = 0;

Expand Down
13 changes: 6 additions & 7 deletions include/boost/graph/transitive_closure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

#include <vector>
#include <algorithm> // for std::min and std::max
#include <functional>
#include <functional> //for std::less
#include <boost/config.hpp>
#include <boost/bind/bind.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/topological_sort.hpp>
#include <boost/graph/graph_concepts.hpp>
Expand Down Expand Up @@ -130,16 +129,16 @@ void transitive_closure(const Graph& g, GraphTC& tc,
std::vector< std::vector< cg_vertex > > CG_vec(num_vertices(CG));
for (size_type i = 0; i < num_vertices(CG); ++i)
{
using namespace boost::placeholders;

typedef typename boost::graph_traits< CG_t >::adjacency_iterator
cg_adj_iter;
std::pair< cg_adj_iter, cg_adj_iter > pr = adjacent_vertices(i, CG);
CG_vec[i].assign(pr.first, pr.second);
std::sort(CG_vec[i].begin(), CG_vec[i].end(),
boost::bind(std::less< cg_vertex >(),
boost::bind(detail::subscript(topo_number), _1),
boost::bind(detail::subscript(topo_number), _2)));
[&topo_number](const auto& cg_0, const auto& cg_1)
{
return std::less< cg_vertex >()(
topo_number[cg_0], topo_number[cg_1]);
});
}

std::vector< std::vector< cg_vertex > > chains;
Expand Down
5 changes: 1 addition & 4 deletions test/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ bool check_vertex_cleared(Graph& g, Vertex v, ID id)
found = ai;
break;
}
#elif defined(BOOST_NO_CXX98_BINDERS)
found
= std::find_if(ai, aiend, std::bind(cmp, v, std::placeholders::_1));
#else
found = std::find_if(ai, aiend, std::bind1st(cmp, v));
found = std::find_if(ai, aiend, [&v, &cmp](const auto& el) { return cmp(v, el); });
#endif

if (found != aiend)
Expand Down
Loading