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的boost :: indirect_iterator <性病::设置:迭代>迭代器; –
2012-01-02 16:12:33