我想將a
中包含的所有整數複製到b
。升壓範圍for_each,bind,copy和back_inserter組合失敗
#include <vector>
#include <iterator>
#include <boost/bind.hpp>
#include <boost/range/algorithm/for_each.hpp>
#include <boost/range/algorithm/copy.hpp>
void test()
{
std::vector<std::vector<int> > a;
std::vector<int> b;
boost::for_each(a, boost::bind(boost::copy, _1, std::back_inserter(b)));
}
看起來很簡單。我想要一個兼容C++ 98的班輪。
爲什麼不編譯? 我有一長串關於boost::bind
的錯誤列表,我不明白,而且它是多頁多長。
錯誤C2780:
錯誤開頭「的boost :: _雙:: bind_t < _bi :: dm_result ::類型,提振:: _ MFI :: DM,_bi :: list_av_1 ::類型> boost :: bind(MT :: *,A1)':期望2個參數 - 3提供
請定義「不起作用」,崩潰?不會編譯?如果你有錯誤信息,請給它。 – Borgleader
它'不起作用',因爲它有'一些錯誤'。如果你更具體,你不會得到更好的答案。 – SergeyA
對不起,添加更多信息 – lars