boost::thread thr(boost::bind(sort,iter, iter))

Hi,

Please advise how to bind std::sort with boost::thread.

I'm trying to do:

boost::thread_group thg;
thg.create_thread(boost::bind(sort<vector<int>::iterator>, mass.begin(), mass.end()));

and get: ThreadSort/main.cpp:40:0 /Users/Maxim/Documents/Projects/SW/C++/ThreadSort/main.cpp:40: error: no matching function for call to 'bind(<unresolved overloaded function type>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >)'

Please HELP!!!
Why not use a function object:

1
2
3
4
5
6
7
8
template< typename Iter >
struct SortOp {
    SortOp( Iter first, Iter last ) : first( first ), last( last ) {}
    void operator()() const { std::sort( first, last ); }
  private:
    Iter first;
    Iter last;
};

You are right it's possible but I don't want to create a functional object I'd like boost::bind to do it itself.
Topic archived. No new replies allowed.