26 a.insert(b.begin(), b.end());
35 std::vector<T> appended_vec(original);
36 appended_vec.emplace_back(item);
51 template <
typename T,
typename... RestArgs>
52 std::vector<T>
functional_append(
const std::vector<T>& original,
const T& first_item, RestArgs... rest_items) {
64 template <
typename K1,
typename K2,
typename V>
65 std::size_t
multimap_size(
const std::map<K1, std::map<K2, V>>& multimap) {
66 std::size_t count = 0;
67 for(
const auto& map_pair : multimap) {
68 count += map_pair.second.size();
79 template <
typename K,
typename V>
82 for(
const auto& pair : map) {
83 keys.emplace_back(pair.first);
98 template <
typename Container>
99 std::size_t
index_of(
const Container& container,
const typename Container::value_type& elem) {
100 return std::distance(std::begin(container),
101 std::find(std::begin(container),
102 std::end(container), elem));
std::list< K > keys_as_list(const std::map< K, V > &map)
Constructs a std::list of the keys in a std::map, in the same order as they appear in the std::map...
std::size_t multimap_size(const std::map< K1, std::map< K2, V >> &multimap)
Returns the size of a std::map of std::maps, by counting up the sizes of all the inner maps...
std::set< T > functional_insert(std::set< T > &a, const std::set< T > &b)
Inserts set b into set a and returns the modified a.
std::size_t index_of(const Container &container, const typename Container::value_type &elem)
Finds a value in a STL container, and returns the index of that value in the container.
std::vector< T > functional_append(const std::vector< T > &original, const T &item)
Base case for functional_append, with one argument.