1
使用しようとしているときboost :: indirect_iterator「intはクラス、構造体、または共用体型ではありません。 どこに間違っているのか誰にでも見えますか?boost :: indirect_iteratorの使用
#include <iostream>
#include <set>
#include <boost/iterator/indirect_iterator.hpp>
// Expose the itererator if the container stores pointers.
class MyCollection
{
public:
// Iterator interface
typedef boost::indirect_iterator<int*> iterator;
iterator begin() { return objects.begin(); }
iterator end() { return objects.end(); }
private:
std::set<int*> objects;
};
int main()
{
MyCollection myCollection;
for(MyCollection::iterator iterator = myCollection.begin(); iterator != myCollection.end(); iterator++)
{
std::cout << " " << *iterator;
}
return 0;
}
を高めるのtypedef :: indirect_iteratorイテレータ< ::イテレータを設定するのstd ::>; –