template<typename
ValueType, typename Extractor>
class llvm::VarStreamArrayIterator< ValueType, Extractor >
VarStreamArray represents an array of variable length records backed by a stream.
This could be a contiguous sequence of bytes in memory, it could be a file on disk, or it could be a PDB stream where bytes are stored as discontiguous blocks in a file. Usually it is desirable to treat arrays as contiguous blocks of memory, but doing so with large PDB files, for example, could mean allocating huge amounts of memory just to allow re-ordering of stream data to be contiguous before iterating over it. By abstracting this out, we need not duplicate this memory, and we can iterate over arrays in arbitrarily formatted streams. Elements are parsed lazily on iteration, so there is no upfront cost associated with building or copying a VarStreamArray, no matter how large it may be.
You create a VarStreamArray by specifying a ValueType and an Extractor type. If you do not specify an Extractor type, you are expected to specialize VarStreamArrayExtractor<T> for your ValueType.
By default an Extractor is default constructed in the class, but in some cases you might find it useful for an Extractor to maintain state across extractions. In this case you can provide your own Extractor through a secondary constructor. The following examples show various ways of creating a VarStreamArray.
// Will use VarStreamArrayExtractor<MyType> as the extractor.
VarStreamArray<MyType> MyTypeArray;
// Will use a default-constructed MyExtractor as the extractor.
VarStreamArray<MyType, MyExtractor> MyTypeArray2;
// Will use the specific instance of MyExtractor provided.
// MyExtractor need not be default-constructible in this case.
MyExtractor E(SomeContext);
VarStreamArray<MyType, MyExtractor> MyTypeArray3(E);
Definition at line 156 of file BinaryStreamArray.h.