この Boost.Range と C++11 範囲ベースの for ループの使用法を検討してください。MSVS 2012 ではコンパイルされません。
#include <iostream>
#include <vector>
#include <boost/container/vector.hpp>
#include <boost/range/algorithm/find.hpp>
int main()
{
std::vector<int> vec;
for(auto i : boost::find(vec, 1))
{
std::cout << "lolwut";
}
return 0;
}
コンパイラ出力:
1>...\main.cpp(10): error C3312: no callable 'begin' function found for type 'boost::container::container_detail::vector_iterator<Pointer>'
1> with
1> [
1> Pointer=int *
1> ]
1>...\main.cpp(10): error C3312: no callable 'end' function found for type 'boost::container::container_detail::vector_iterator<Pointer>'
1> with
1> [
1> Pointer=int *
1> ]
1>
1>Build FAILED.
Boost.Rangeは範囲ベースのforループ内では使用できませんか? または、私は何を間違っていますか?ありがとう!