Small useful algorithms.
Definition in file algo.hpp.
Go to the source code of this file.
#include <algorithm>#include <cstddef>#include <iterator>#include <optional>#include <string>#include <string_view>#include <type_traits>#include <utility>#include <userver/utils/checked_pointer.hpp>
 Include dependency graph for algo.hpp:
 This graph shows which files directly or indirectly include this file:Namespaces | |
| namespace | utils | 
| Utilities.  | |
Functions | |
| template<typename ResultString = std::string, typename... Strings> | |
| ResultString | utils::StrCat (const Strings &... strings) | 
Concatenates multiple std::string_view-convertible items.   | |
| template<class Map , class Key > | |
| auto * | utils::FindOrNullptr (Map &map, const Key &key) | 
| Returns nullptr if no key in associative container, otherwise returns pointer to value.   | |
| template<class Map , class Key , class Default > | |
| Map::mapped_type | utils::FindOrDefault (Map &map, const Key &key, Default &&def) | 
| Returns default value if no key in associative container, otherwise returns a copy of the stored value.   | |
| template<class Map , class Key > | |
| Map::mapped_type | utils::FindOrDefault (Map &map, const Key &key) | 
| Returns default value if no key in associative container, otherwise returns a copy of the stored value.   | |
| template<class Map , class Key > | |
| std::optional< typename Map::mapped_type > | utils::FindOptional (Map &map, const Key &key) | 
| Returns std::nullopt if no key in associative container, otherwise returns std::optional with a copy of value.   | |
| template<typename Map , typename Key > | |
| auto | utils::CheckedFind (Map &map, const Key &key) -> decltype(utils::MakeCheckedPtr(&map.find(key) ->second)) | 
| Searches a map for an element and return a checked pointer to the found element.   | |
| template<class ToContainer , class FromContainer > | |
| ToContainer | utils::AsContainer (FromContainer &&container) | 
| Converts one container type to another.   | |
| template<class Container , class Pred > | |
| auto | utils::EraseIf (Container &container, Pred pred) | 
| Erased elements and returns number of deleted elements.   | |
| template<class Container , class T > | |
| size_t | utils::Erase (Container &container, const T &elem) | 
| Erased elements and returns number of deleted elements.   | |
| template<typename Container , typename Pred > | |
| bool | utils::ContainsIf (const Container &container, Pred pred) | 
| returns true if there is an element in container which satisfies the predicate   | |