Skip to content

Commit

Permalink
Merge pull request #271 from linas/minor-cleanup
Browse files Browse the repository at this point in the history
Cleanup algorithm.h
  • Loading branch information
linas authored Sep 20, 2023
2 parents bcff50a + fc957e9 commit f8c209b
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions opencog/util/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@

#include <algorithm>
#include <set>
#include <boost/lexical_cast.hpp>
#include <boost/bind/bind.hpp>

#include <algorithm>

#include <opencog/util/numeric.h>
#include <opencog/util/exceptions.h>

Expand All @@ -17,14 +14,6 @@ namespace opencog
* @{
*/

/// @todo these needs to be changed for non-gcc
// using std::copy_n;
// using std::lexicographical_compare_3way;
// using std::random_sample_n;
// using std::random_sample;
// using std::is_heap;
using std::is_sorted;

//! binary for_each
template<typename It1, typename It2, typename F>
F for_each(It1 from1, It1 to1, It2 from2, F f)
Expand Down Expand Up @@ -274,11 +263,9 @@ Set set_symmetric_difference(const Set& s1, const Set& s2) {
template<typename It, typename Pred, typename Out>
Out n_way_partition(It begin, It end, const Pred p, int n, Out out)
{
using namespace boost::placeholders;

// could be made more efficient if needed
for (int i = 0;i < n - 1;++i)
*out++ = begin = std::partition(begin, end, boost::bind(p, _1) == i);
*out++ = begin = std::partition(begin, end, boost::bind(p, boost::placeholders::_1) == i);
return out;
}

Expand Down Expand Up @@ -360,8 +347,6 @@ std::set<std::vector<typename C::value_type>> cartesian_product(const C& c,
* Given a sequence of indexes, and a sequence of elements, return a
* sequence of all elements corresponding to the indexes (in the order
* of the indexes).
*
* Maybe boost offers something like that already but I can't find it.
*/
template<typename Indices, typename Seq>
Seq seq_filtered(const Seq& seq, const Indices& indices)
Expand Down

0 comments on commit f8c209b

Please sign in to comment.