Skip to content

Commit

Permalink
Replace Boost::foreach dependency with range-based for
Browse files Browse the repository at this point in the history
  • Loading branch information
georgthegreat committed Dec 21, 2024
1 parent 4fc3afa commit 3f70bf4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ target_link_libraries(${_boost_python}
Boost::conversion
Boost::core
Boost::detail
Boost::foreach
Boost::function
Boost::iterator
Boost::lexical_cast
Expand Down
1 change: 0 additions & 1 deletion build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ constant boost_dependencies :
/boost/conversion//boost_conversion
/boost/core//boost_core
/boost/detail//boost_detail
/boost/foreach//boost_foreach
/boost/function//boost_function
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
Expand Down
13 changes: 4 additions & 9 deletions include/boost/python/suite/indexing/container_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,21 @@
# define PY_CONTAINER_UTILS_JDG20038_HPP

# include <utility>
# include <boost/foreach.hpp>
# include <boost/python/object.hpp>
# include <boost/python/handle.hpp>
# include <boost/python/extract.hpp>
# include <boost/python/stl_iterator.hpp>

namespace boost { namespace python { namespace container_utils {

template <typename Container>
void
extend_container(Container& container, object l)
{
typedef typename Container::value_type data_type;

// l must be iterable
BOOST_FOREACH(object elem,
std::make_pair(
boost::python::stl_input_iterator<object>(l),
boost::python::stl_input_iterator<object>()
))
for (object elem: l)
{
extract<data_type const&> x(elem);
// try if elem is an exact data_type type
Expand All @@ -49,7 +44,7 @@ namespace boost { namespace python { namespace container_utils {
throw_error_already_set();
}
}
}
}
}

}}} // namespace boost::python::container_utils
Expand Down

0 comments on commit 3f70bf4

Please sign in to comment.