CGRA-ME
|
#include <algorithm>
#include <numeric>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | iterator_range< BIter, EIter > |
struct | tuple_get_range< get_index, Range > |
struct | tuple_get_range< get_index, Range >::iterator< Iter > |
struct | SingleItemImmutableSet< VertexID > |
struct | StandardMapMaker< Map, InitialParams > |
struct | StandardSetMaker< Set, InitialParams > |
struct | VectorMap< IndexMap, Key, MappedType > |
Provides some standard map operations, with a fixed size. More... | |
struct | VectorMap< IndexMap, Key, MappedType >::const_iterator |
struct | VectorMap< IndexMap, Key, MappedType >::iterator |
struct | VectorSet< IndexMap, Value > |
Provides some standard set operations, with a fixed size. More... | |
struct | VectorSet< IndexMap, Value >::const_iterator |
struct | VectorSet< IndexMap, Value >::iterator |
struct | VectorMapMaker< InitialParams > |
struct | VectorSetMaker< InitialParams > |
struct | detail::shift_in_printer |
Namespaces | |
detail | |
Functions | |
template<typename BIter , typename EIter = BIter> | |
auto | make_iterator_range (BIter &&b, EIter &&e) |
template<typename BIter , typename EIter = BIter> | |
auto | make_iterator_range (const std::pair< BIter, EIter > &p) |
template<typename Range , typename = decltype(begin(std::declval<Range>()))> | |
auto | make_iterator_range (const Range &r) |
template<int get_index, typename Range > | |
tuple_get_range< get_index, Range > | make_tuple_get_range (Range &&r) |
template<typename Range > | |
tuple_get_range< 1, Range > | make_second_of_pair_range (Range &&r) |
template<typename Range > | |
tuple_get_range< 0, Range > | make_first_of_pair_range (Range &&r) |
template<typename Range > | |
auto | reversed (Range &r) |
template<typename VertexID > | |
auto | cbegin (const SingleItemImmutableSet< VertexID > &siis) |
template<typename VertexID > | |
auto | cend (const SingleItemImmutableSet< VertexID > &siis) |
template<typename VertexID > | |
auto | begin (const SingleItemImmutableSet< VertexID > &siis) |
template<typename VertexID > | |
auto | end (const SingleItemImmutableSet< VertexID > &siis) |
template<typename VertexID > | |
auto | begin (SingleItemImmutableSet< VertexID > &siis) |
template<typename VertexID > | |
auto | end (SingleItemImmutableSet< VertexID > &siis) |
template<typename VertexID > | |
SingleItemImmutableSet< VertexID > | singleItemSet (VertexID v) |
template<typename COLLECTION , typename UNARY_PREDICATE > | |
auto | filter_collection (const COLLECTION &base_container, UNARY_PREDICATE &&filter) |
template<typename R1 , typename R2 > | |
bool | are_ranges_same (const R1 &r1, const R2 &r2) |
template<typename ASSOCIATIVE_COLLECTION , typename KEY , typename DEFAULT_VALUE > | |
auto | value_for_key_or (ASSOCIATIVE_COLLECTION &assoc_collection, const KEY &key, DEFAULT_VALUE &default_value) -> std::conditional_t< std::is_lvalue_reference< DEFAULT_VALUE >::value, decltype(false ? default_value :assoc_collection.find(key) ->second)&, decltype(false ? default_value :assoc_collection.find(key) ->second) > |
template<typename ASSOCIATIVE_COLLECTION , typename KEY , typename VALUE > | |
auto | insert_or_assign (ASSOCIATIVE_COLLECTION &assoc_collection, KEY &&key, VALUE &&value) |
template<typename InputIt , typename ForwardIt , typename BinaryPredicate > | |
std::pair< InputIt, ForwardIt > | find_first_of_and_matching (InputIt first, InputIt last, ForwardIt s_first, ForwardIt s_last, BinaryPredicate p) |
template<typename InputIt , typename ForwardIt > | |
auto | find_first_of_and_matching (InputIt first, InputIt last, ForwardIt s_first, ForwardIt s_last) |
template<typename Range1 , typename Range2 , typename BinaryPredicate > | |
auto | find_first_of_and_matching (Range1 &&r1, Range2 &r2, BinaryPredicate p) |
template<typename Range1 , typename Range2 > | |
auto | find_first_of_and_matching (Range1 &&r1, Range2 &r2) |
template<typename CONTAINER , typename OSTREAM , typename PRINTER = detail::shift_in_printer, typename T1 , typename T2 , typename T3 > | |
void | print_container (OSTREAM &&os, const CONTAINER &c, const T1 &element_separator, const T2 &container_prefix, const T3 &container_suffix, PRINTER &&element_printer=PRINTER{}) |
template<typename CONTAINER , typename OSTREAM , typename PRINTER = detail::shift_in_printer> | |
void | print_container (OSTREAM &&os, const CONTAINER &c, PRINTER &&element_printer=PRINTER{}) |
template<typename ASSOC_CONTAINER , typename OSTREAM , typename KEY_PRINTER = detail::shift_in_printer, typename VALUE_PRINTER = detail::shift_in_printer, typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > | |
void | print_assoc_container (OSTREAM &&os, const ASSOC_CONTAINER &c, const T1 &element_separator, const T2 &key_value_separator, const T3 &element_prefix, const T4 &element_suffix, const T5 &container_prefix, const T6 &container_suffix, KEY_PRINTER &&value_printer=KEY_PRINTER{}, VALUE_PRINTER &&key_printer=VALUE_PRINTER{}) |
template<typename ASSOC_CONTAINER , typename OSTREAM , typename KEY_PRINTER = detail::shift_in_printer, typename VALUE_PRINTER = detail::shift_in_printer> | |
void | print_assoc_container (OSTREAM &&os, const ASSOC_CONTAINER &c, KEY_PRINTER &&value_printer=KEY_PRINTER{}, VALUE_PRINTER &&key_printer=VALUE_PRINTER{}) |
template<typename T = std::vector<int>> | |
T | make_zero_to_n_minus_one_list (std::ptrdiff_t n) |
bool are_ranges_same | ( | const R1 & | r1, |
const R2 & | r2 | ||
) |
Do the ranges r1
and r2
have the same elements, and are they the same size? Uses operator==
.
Definition at line 328 of file Collections.h.
auto begin | ( | const SingleItemImmutableSet< VertexID > & | siis | ) |
Definition at line 137 of file Collections.h.
auto begin | ( | SingleItemImmutableSet< VertexID > & | siis | ) |
Definition at line 139 of file Collections.h.
auto cbegin | ( | const SingleItemImmutableSet< VertexID > & | siis | ) |
Definition at line 135 of file Collections.h.
auto cend | ( | const SingleItemImmutableSet< VertexID > & | siis | ) |
Definition at line 136 of file Collections.h.
auto end | ( | const SingleItemImmutableSet< VertexID > & | siis | ) |
Definition at line 138 of file Collections.h.
auto end | ( | SingleItemImmutableSet< VertexID > & | siis | ) |
Definition at line 140 of file Collections.h.
auto filter_collection | ( | const COLLECTION & | base_container, |
UNARY_PREDICATE && | filter | ||
) |
Copies elements from base_container
to a default-constructed instance of COLLECTION
. Only copies element where filter returns a truth value.
Definition at line 317 of file Collections.h.
auto find_first_of_and_matching | ( | InputIt | first, |
InputIt | last, | ||
ForwardIt | s_first, | ||
ForwardIt | s_last | ||
) |
Definition at line 390 of file Collections.h.
std::pair<InputIt,ForwardIt> find_first_of_and_matching | ( | InputIt | first, |
InputIt | last, | ||
ForwardIt | s_first, | ||
ForwardIt | s_last, | ||
BinaryPredicate | p | ||
) |
Same as std::find_first_of, but returns a pair of iterators, one from each range. Modified from https://en.cppreference.com/w/cpp/algorithm/find_first_of
Definition at line 373 of file Collections.h.
auto find_first_of_and_matching | ( | Range1 && | r1, |
Range2 & | r2 | ||
) |
Definition at line 409 of file Collections.h.
auto find_first_of_and_matching | ( | Range1 && | r1, |
Range2 & | r2, | ||
BinaryPredicate | p | ||
) |
Definition at line 402 of file Collections.h.
auto insert_or_assign | ( | ASSOCIATIVE_COLLECTION & | assoc_collection, |
KEY && | key, | ||
VALUE && | value | ||
) |
C++17 member function.
Definition at line 358 of file Collections.h.
tuple_get_range<0, Range> make_first_of_pair_range | ( | Range && | r | ) |
Definition at line 111 of file Collections.h.
auto make_iterator_range | ( | BIter && | b, |
EIter && | e | ||
) |
Definition at line 48 of file Collections.h.
auto make_iterator_range | ( | const Range & | r | ) |
Definition at line 60 of file Collections.h.
auto make_iterator_range | ( | const std::pair< BIter, EIter > & | p | ) |
Definition at line 54 of file Collections.h.
tuple_get_range<1, Range> make_second_of_pair_range | ( | Range && | r | ) |
Definition at line 106 of file Collections.h.
tuple_get_range<get_index, Range> make_tuple_get_range | ( | Range && | r | ) |
Definition at line 101 of file Collections.h.
T make_zero_to_n_minus_one_list | ( | std::ptrdiff_t | n | ) |
Definition at line 542 of file Collections.h.
void print_assoc_container | ( | OSTREAM && | os, |
const ASSOC_CONTAINER & | c, | ||
const T1 & | element_separator, | ||
const T2 & | key_value_separator, | ||
const T3 & | element_prefix, | ||
const T4 & | element_suffix, | ||
const T5 & | container_prefix, | ||
const T6 & | container_suffix, | ||
KEY_PRINTER && | value_printer = KEY_PRINTER{} , |
||
VALUE_PRINTER && | key_printer = VALUE_PRINTER{} |
||
) |
Prints an associative container to os
, using operator<<
. Defaults to printing elements using operator<<
, but this can be overridden with the 'printer' arguments. Value type must model std::pair
. Printing is of the form: container_prefix
element_prefix
key_printer(os,key1)
key_value_separator
value_printer(os,val1)
element_suffix
element_separator
... container_suffix
Definition at line 488 of file Collections.h.
void print_assoc_container | ( | OSTREAM && | os, |
const ASSOC_CONTAINER & | c, | ||
KEY_PRINTER && | value_printer = KEY_PRINTER{} , |
||
VALUE_PRINTER && | key_printer = VALUE_PRINTER{} |
||
) |
Prints the given associative container c
to os
in the format: {{ key1 -> val1 }, { key2 -> val2 }, ...}
ex.: std::unordered_map<int, float> nums; print_assoc_container(std::cout, nums);
Definition at line 532 of file Collections.h.
void print_container | ( | OSTREAM && | os, |
const CONTAINER & | c, | ||
const T1 & | element_separator, | ||
const T2 & | container_prefix, | ||
const T3 & | container_suffix, | ||
PRINTER && | element_printer = PRINTER{} |
||
) |
Prints a container to os
, using operator<<
. Defaults to printing elements using operator<<
, but this can be overridden with the 'printer' argument. Printing is of the form: container_prefix
element_printer(elem1)
element_separator
element_printer(os,elem2)
element_separator
... container_suffix
Definition at line 435 of file Collections.h.
void print_container | ( | OSTREAM && | os, |
const CONTAINER & | c, | ||
PRINTER && | element_printer = PRINTER{} |
||
) |
Prints the given container c
to os
in the format: "{ " elem1 ", " elem2 ", " ... " }"
ex.: std::vector<int> nums; print_container(std::cout, nums);
Definition at line 467 of file Collections.h.
auto reversed | ( | Range & | r | ) |
Definition at line 116 of file Collections.h.
SingleItemImmutableSet<VertexID> singleItemSet | ( | VertexID | v | ) |
Definition at line 143 of file Collections.h.
auto value_for_key_or | ( | ASSOCIATIVE_COLLECTION & | assoc_collection, |
const KEY & | key, | ||
DEFAULT_VALUE & | default_value | ||
) | -> std::conditional_t< std::is_lvalue_reference<DEFAULT_VALUE>::value, decltype(false ? default_value : assoc_collection.find(key)->second)&, decltype(false ? default_value : assoc_collection.find(key)->second) > |
Performs the common pattern of looking up an item in a map, and giving some default value instead of throwing or giving an "end" iterator. Note: only returns by reference if default_value
is a lvalue. uses ASSOCIATIVE_COLLECTION::find(const KEY&)
.
Definition at line 339 of file Collections.h.