Example Program
Rooted Iterators
Example for some functions for handling (rooted) iterators.
A tutorial about the use of rooted iterators.
1#include <iostream>
2#include <seqan/sequence.h>
3#include <seqan/file.h>
5using namespace seqan;
7int main()
9    typedef String<char> TText;
10    TText str = "abcdefg";
The rooted iterator can be specified by passing the iterator spec Rooted as a second argument.
11    Iterator<TText, Rooted>::Type it = begin(str);
The same iterator spec can be used as a tag for functions that return an iterator, e.g. begin or end.
12    it = begin(str, Rooted());
A rooted iterator "knows" its container, so it supports the function container.
13    std::cout << container(it);          //output: "abcdefg"
14    goNext(it);
It also supports functions such as goBegin or position.
15    std::cout << position(it);           //output: 7
16    return 0;
SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2013/07/11 09:12:35