Какие библиотеки мне нужны для использования std :: placeholder?

В настоящее время я пытаюсь сгенерировать комбинации и использую следующий код:

#include <vector>
#include <algorithm>
#include <iostream>
#include <functional>

template<class RandIt, class Compare>
bool next_combination(RandIt first, RandIt mid, RandIt last)
{
    std::sort(mid, last, std::bind(std::less<int>(), std::placeholders::_2
                                            , std::placeholders::_1));
    return std::next_permutation(first, last, std::less<int>());
}

При использовании g ++ не удается скомпилировать высказывание:

next_combo.cpp: In function ‘bool next_combination(RandIt, RandIt, RandIt)’:
next_combo.cpp:10: error: ‘bind’ is not a member of ‘std’
next_combo.cpp:10: error: ‘std::placeholders’ has not been declared
next_combo.cpp:11: error: ‘std::placeholders’ has not been declared

Я думал, что std :: placeholder были заявлено в функционале, но сейчас я запуталась. Should I just use boost?

Also the rest of the project is using c++0x, so is there a better way to write this using c++0x features?

Any help is greatly appreciated :)

8
задан shuttle87 23 December 2010 в 07:32
поделиться