CBMC
range.h File Reference

Ranges: pair of begin and end iterators, which can be initialized from containers, provide useful methods such as map, filter and concat which only manipulate iterators, and can be used with ranged-for. More...

#include <util/invariant.h>
#include <functional>
#include <memory>
#include <type_traits>
+ Include dependency graph for range.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  map_iteratort< iteratort, outputt >
 Iterator which applies some given function f after each increment and returns its result on dereference. More...
 
class  filter_iteratort< iteratort >
 Iterator which only stops at elements for which some given function f is true. More...
 
struct  concat_iteratort< first_iteratort, second_iteratort >
 On increment, increments a first iterator and when the corresponding end iterator is reached, starts to increment a second one. More...
 
struct  zip_iteratort< first_iteratort, second_iteratort, same_size >
 Zip two ranges to make a range of pairs. More...
 
struct  ranget< iteratort >
 A range is a pair of a begin and an end iterators. More...
 

Functions

template<typename iteratort >
ranget< iteratort > make_range (iteratort begin, iteratort end)
 
template<typename containert >
auto make_range (containert &container) -> ranget< decltype(container.begin())>
 
template<typename multimapt >
ranget< typename multimapt::const_iterator > equal_range (const multimapt &multimap, const typename multimapt::key_type &key)
 Utility function to make equal_range method of multimap easier to use by returning a ranget object. More...
 

Detailed Description

Ranges: pair of begin and end iterators, which can be initialized from containers, provide useful methods such as map, filter and concat which only manipulate iterators, and can be used with ranged-for.

Definition in file range.h.

Function Documentation

◆ equal_range()

template<typename multimapt >
ranget<typename multimapt::const_iterator> equal_range ( const multimapt &  multimap,
const typename multimapt::key_type &  key 
)

Utility function to make equal_range method of multimap easier to use by returning a ranget object.

For instance, we can write: for(auto value : equal_range(map, key).filter(...).map(...)) {...}.

Definition at line 539 of file range.h.

◆ make_range() [1/2]

template<typename containert >
auto make_range ( containert &  container) -> ranget<decltype(container.begin())>

Definition at line 528 of file range.h.

◆ make_range() [2/2]

template<typename iteratort >
ranget<iteratort> make_range ( iteratort  begin,
iteratort  end 
)

Definition at line 522 of file range.h.