Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
User Manual

Specialized_iterators

Authors: F. Cazals and T. Dreyfus

Introduction

This package is dedicated to iterators over containers with particular specifications.

Implementation

Container of Containers Iterator

Two iterators are defined:

The template parameter OuterContainerIterator specifies the iterator over the mutable outer container, while OuterContainerConstIterator specifies the iterator over the non-mutable outer container.

Dependencies

This package has no internal nor external dependency.

Examples

Container of Containers Iterator Example

This example presents SBL::CADS::T_Container_of_containers_const_iterator :

#include <SBL/CADS/Container_of_containers_iterator.hpp>
#include <set>
#include <vector>
#include <iostream>
//Inner container is a set of integers, outer container is a vector of
//these sets.
typedef std::set<int> Index_set;
typedef std::vector<Index_set> Index_set_vector;
//The iterator is instantiated with a const iterator over the outer
//container
<Index_set_vector::const_iterator> Container_of_containers_const_iterator;
int main()
{
//Creation of a vector of 3 sets of integers: {0}, {1, 2} and {3, 4,
//5}.
Index_set_vector sets(3);
sets[0].insert(0);
sets[1].insert(1);sets[1].insert(2);
sets[2].insert(3);sets[2].insert(4);sets[2].insert(5);
//Use the Container_of_containers_const_iterator for computing the
//total number of elements in the sets.
int n =
std::distance(Container_of_containers_const_iterator(sets.begin(), sets.end()),
Container_of_containers_const_iterator(sets.end(), sets.end()));
std::cout << "Iterate over " << n << " elements." << std::endl;
return 0;
}
Iterator iterator over nested non-mutable containers.
Definition: Container_of_containers_iterator.hpp:226
n
Definition: extract-wales-graph.py:70