Anon
Anon

Reputation: 421

Iterator to class LoopInfoBase<BasicBlock, Loop>?

I read the llvm page on LoopInfoBase(BlockT, LoopT), and understand that it contains information of all top level loops. It also has iterators (and reverse iterators etc) defined within the class template.

I don't quite understand what the iterator is iterating over? For example in vector<int>, an iterator i would iterate over the container vector and *i is an int, in Map<string, int>, an iterator i would iterate over the map and *i would be a pair of type <string, int>. However here, there is a class template, so suppose i is an iterator of such a class, then what would *i represent (alternatively what would be it's type)?

Upvotes: 1

Views: 125

Answers (1)

Garrigan Stafford
Garrigan Stafford

Reputation: 1403

In the case of the file you mention the type of iterator is

typedef std::vector<LoopT *>::const_iterator llvm::LoopInfoBase< BlockT, LoopT >::iterator

So we see it is const_iterator (an iterator of const values) of a vector of LoopT pointers.

Im a little curious on why you are diving into the LLVM docs. If you are attempting to learn C++ I would not reccomend trying to learn through the LLVM compiler docs, seems like a overly difficult way to learn the language. Try tutorials like http://www.cplusplus.com/doc/

Upvotes: 1

Related Questions