TRIQS/itertools 1.3.0
C++ range library
Loading...
Searching...
No Matches
API Documentation

The following provides a detailed reference documentation grouped into logical units.

For most users of the library it should be sufficient to either use one of the Range adapting functions or an Integer range.

If you are looking for a specific function, class, etc., try using the search bar in the top left corner.

Range adapting functions

Range adapting functions take one or more existing ranges and return lazy Adapted ranges that can be iterated over. Lazy means that new elements are produced on the fly whenever they are needed instead of being precomputed when the range is created.

The following range adpating functions are available in itertools:

Adapted ranges

Adapted ranges are returned by the range adapting functions and can be iterated over using one of the Range iterators. In most cases, the user will never have to create or modify an adapted range directly. Instead, it is recommended to simply use the provided Range adapting functions.

The following adapted ranges are defined in itertools:

Range iterators

Range iterators are internally used by the library to iterate over Adapted ranges. In general, there should be no need for users to deal with range iterators directly. Instead, it is recommended to use range-based for loops, e.g.

for (auto [idx, val] : itertools::enumerate(some_range)) {
// do something with the index and the value of the range
}
enumerated< R > enumerate(R &&rg)
Lazy-enumerate a given range (similar to Python's enumerate).

vs. the traditional for loops, e.g.

auto enum_range = itertools::enumerate(some_range);
for (auto it = enum_range.begin(); it != enum_range.end(); ++it) {
// do something with the iterator
}

The following range iterators are defined in itertools:

Integer range

An Integer range is similar to a Python range. It is defined by a start value, an end value and a step size such that the i-th value of the range is given by start + i * step.

The following classes and functions related to integer ranges are defined in itertools:

Utilities

Utilities are mostly internal implementation details and should not concern everyday users. The only functions the might be intersting to some users are: chunk_range, make_vector_from_range and omp_chunk.

The following utilities are defined in itertools: