|
template<typename... Strings> |
std::string | StrCat (const Strings &... strings) |
| Concatenates multiple std::string_view -convertible items.
|
|
template<class Map , class Key > |
auto * | 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 | 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 | 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 > | 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 | 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 | AsContainer (FromContainer &&container) |
| Converts one container type to another.
|
|
template<class Container , class Pred > |
auto | EraseIf (Container &container, Pred pred) |
| Erased elements and returns number of deleted elements.
|
|
template<class Container , class T > |
size_t | Erase (Container &container, const T &elem) |
| Erased elements and returns number of deleted elements.
|
|
template<typename Container , typename Pred > |
bool | ContainsIf (const Container &container, Pred pred) |
| returns true if there is an element in container which satisfies the predicate
|
|
template<typename ValueType > |
ValueType * | AnyCast (AnyMovable *operand) noexcept |
|
template<typename ValueType > |
const ValueType * | AnyCast (const AnyMovable *operand) noexcept |
|
template<typename ValueType > |
ValueType | AnyCast (AnyMovable &operand) |
|
template<typename ValueType > |
ValueType | AnyCast (const AnyMovable &operand) |
|
template<typename ValueType > |
ValueType | AnyCast (AnyMovable &&operand) |
|
template<typename T , typename Func > |
T | AtomicUpdate (std::atomic< T > &atomic, Func updater) |
| Atomically performs the operation of updater on atomic
|
|
template<typename T > |
T | AtomicMin (std::atomic< T > &atomic, T value) |
| Concurrently safe sets atomic to a value if value is less.
|
|
template<typename T > |
T | AtomicMax (std::atomic< T > &atomic, T value) |
| Concurrently safe sets atomic to a value if value is greater.
|
|
boost::uuids::uuid | BoostUuidFromString (std::string const &str) |
| Parse string into boost::uuids::uuid.
|
|
std::string | ToString (const boost::uuids::uuid &) |
| Serialize boost::uuids::uuid to string.
|
|
constexpr long long | ToLongLong (BytesPerSecond x) |
|
constexpr bool | operator== (BytesPerSecond lhs, BytesPerSecond rhs) |
|
constexpr bool | operator!= (BytesPerSecond lhs, BytesPerSecond rhs) |
|
BytesPerSecond | StringToBytesPerSecond (const std::string &data) |
|
template<class Value > |
BytesPerSecond | Parse (const Value &v, formats::parse::To< BytesPerSecond >) |
|
template<class T > |
constexpr bool | operator== (const CachedHash< T > &x, const CachedHash< T > &y) |
| Compares utils::CachedHash by hash first and then by keys.
|
|
template<class T > |
constexpr bool | operator!= (const CachedHash< T > &x, const CachedHash< T > &y) |
| Compares utils::CachedHash by hash first and then by keys.
|
|
template<typename T > |
constexpr CheckedPtr< T > | MakeCheckedPtr (T *ptr) noexcept |
|
template<typename Container > |
constexpr auto | enumerate (Container &&iterable) |
| Implementation of python-style enumerate function for range-for loops.
|
|
template<typename T = std::runtime_error> |
void | LogErrorAndThrow (const std::string &error_message) |
| Logs error_message and throws an exception ith that message.
|
|
template<class E > |
| unexpected (E) -> unexpected< E > |
|
template<class GeneratorFunc > |
auto | GenerateFixedArray (std::size_t size, GeneratorFunc &&generator) |
| Applies generator to indices in the range [0, size) , storing the results in a new utils::FixedArray. The generator is guaranteed to be invoked in the first-to-last order.
|
|
template<typename Enum > |
constexpr Flags< Enum > | operator| (Enum, Flags< Enum >) |
|
template<typename Enum > |
constexpr Flags< Enum > | operator& (Enum, Flags< Enum >) |
|
template<typename Enum > |
constexpr bool | operator== (Enum, Flags< Enum >) |
|
template<typename Enum > |
constexpr bool | operator!= (Enum, Flags< Enum >) |
|
template<typename Enum > |
Flags< Enum > | operator| (Enum, const AtomicFlags< Enum > &) |
|
template<typename Enum > |
Flags< Enum > | operator& (Enum, const AtomicFlags< Enum > &) |
|
template<typename Enum > |
bool | operator== (Enum, const AtomicFlags< Enum > &) |
|
template<typename Enum > |
bool | operator!= (Enum, const AtomicFlags< Enum > &) |
|
template<typename T , typename StringType , typename = std::enable_if_t< std::is_convertible_v<StringType, std::string_view>>> |
T | FromString (const StringType &str) |
| Extract the number contained in the string. No space characters or other extra characters allowed. Supported types:
|
|
std::int64_t | FromHexString (const std::string &str) |
|
template<typename Leaf > |
constexpr auto * | GetIf (Leaf &&leaf) |
|
template<typename Root , typename Head , typename... Tail> |
constexpr auto * | GetIf (Root &&root, Head &&head, Tail &&... tail) |
| Dereferences a chain of indirections and compositions, returns nullptr if one of the chain elements is not set.
|
|
std::string | MacaddrToString (Macaddr macaddr) |
| Get 48-bit MAC address as a string in "xx:xx:.." format.
|
|
std::string | Macaddr8ToString (Macaddr8 macaddr) |
| Get 64-bit MAC address as a string in "xx:xx:.." format.
|
|
Macaddr | MacaddrFromString (const std::string &str) |
| Get 48-bit MAC address from std::string.
|
|
Macaddr8 | Macaddr8FromString (const std::string &str) |
| Get 64-bit MAC address from std::string.
|
|
template<class Target , class... Args> |
boost::intrusive_ptr< Target > | make_intrusive_ptr (Args &&... args) |
| Factory function for boost::intrusive_ptr, like std::make_unique.
|
|
template<typename U , typename... Args> |
SharedRef< U > | MakeSharedRef (Args &&... args) |
| An equivalent of std::make_shared for SharedRef.
|
|
template<typename U , typename... Args> |
UniqueRef< U > | MakeUniqueRef (Args &&... args) |
| An equivalent of std::make_unique for UniqueRef.
|
|
template<class T , class U > |
constexpr bool | operator== (OptionalRef< T > lhs, OptionalRef< U > rhs) noexcept |
|
template<class T , class U > |
constexpr bool | operator!= (OptionalRef< T > lhs, OptionalRef< U > rhs) noexcept |
|
template<class T > |
std::string | ToString (const std::optional< T > &from) |
| Converts std::optional to a string, empty value represented as "--".
|
|
template<class... Ts> |
| Overloaded (Ts...) -> Overloaded< Ts... > |
|
template<typename Container , typename Value > |
void | ProjectedInsertOrAssign (Container &set, Value &&value) |
| An equivalent of std::unordered_map::insert_or_assign for utils::ProjectedUnorderedSet and utils::ProjectedSet.
|
|
RandomBase & | DefaultRandom () |
| Returns a thread-local UniformRandomBitGenerator.
|
|
template<typename T > |
T | RandRange (T from_inclusive, T to_exclusive) |
| Generates a random number in range [from, to)
|
|
template<typename T > |
T | RandRange (T to_exclusive) |
| Generates a random number in range [0, to)
|
|
uint32_t | Rand () |
| Generate a random number in the whole uint32_t range.
|
|
bool | regex_match (std::string_view str, const regex &pattern) |
| Determines whether the regular expression matches the entire target character sequence.
|
|
bool | regex_search (std::string_view str, const regex &pattern) |
| Determines whether the regular expression matches anywhere in the target character sequence.
|
|
template<typename T > |
bool | operator== (const SharedReadablePtr< T > &ptr, std::nullptr_t) |
|
template<typename T > |
bool | operator== (std::nullptr_t, const SharedReadablePtr< T > &ptr) |
|
template<typename T > |
bool | operator!= (const SharedReadablePtr< T > &ptr, std::nullptr_t) |
|
template<typename T > |
bool | operator!= (std::nullptr_t, const SharedReadablePtr< T > &ptr) |
|
template<typename T , typename... Args> |
SharedReadablePtr< T > | MakeSharedReadable (Args &&... args) |
|
template<std::size_t N> |
bool | operator== (const SmallString< N > &str, std::string_view sv) |
|
template<std::size_t N> |
bool | operator== (std::string_view sv, const SmallString< N > &str) |
|
template<std::size_t N> |
bool | operator== (const SmallString< N > &str1, const SmallString< N > &str2) |
|
template<std::size_t N> |
bool | operator!= (const SmallString< N > &str1, const SmallString< N > &str2) |
|
template<typename Value , std::size_t N> |
Value | Serialize (const SmallString< N > &value, formats::serialize::To< Value >) |
|
template<typename Value , std::size_t N> |
SmallString< N > | Parse (const Value &value, formats::parse::To< SmallString< N > >) |
|
template<typename Key , typename Value > |
auto | WithSafeHash (const std::unordered_map< Key, Value > &map) |
| Converts an unordered [multi-]map or set with the default hash to a map with utils::StrCaseHash. This might be useful when converting guaranteed-to-be-safe data to a common operating format.
|
|
template<typename Key , typename Value > |
auto | WithSafeHash (std::unordered_map< Key, Value > &&map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename Key , typename Value > |
auto | WithSafeHash (const std::unordered_multimap< Key, Value > &map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename Key , typename Value > |
auto | WithSafeHash (std::unordered_multimap< Key, Value > &&map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename Key > |
auto | WithSafeHash (const std::unordered_set< Key > &map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename Key > |
auto | WithSafeHash (std::unordered_set< Key > &&map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename Key > |
auto | WithSafeHash (const std::unordered_multiset< Key > &map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename Key > |
auto | WithSafeHash (std::unordered_multiset< Key > &&map) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
std::chrono::milliseconds | StringToDuration (const std::string &data) |
| Converts strings like "10s", "5d", "1h" to durations.
|
|
constexpr bool | operator& (StrongTypedefOps op, StrongTypedefOps mask) noexcept |
|
constexpr auto | operator| (StrongTypedefOps op1, StrongTypedefOps op2) noexcept |
|
template<class Tag , class T , StrongTypedefOps Ops> |
std::ostream & | operator<< (std::ostream &os, const StrongTypedef< Tag, T, Ops > &v) |
| Ostreams and Logging.
|
|
template<class Tag , class T , StrongTypedefOps Ops> |
logging::LogHelper & | operator<< (logging::LogHelper &os, const StrongTypedef< Tag, T, Ops > &v) |
|
template<class Tag , class T , StrongTypedefOps Ops> |
constexpr decltype(auto) | UnderlyingValue (const StrongTypedef< Tag, T, Ops > &v) noexcept |
|
template<class Tag , class T , StrongTypedefOps Ops> |
constexpr T | UnderlyingValue (StrongTypedef< Tag, T, Ops > &&v) noexcept |
|
constexpr bool | IsStrongTypedefLoggable (StrongTypedefOps Ops) |
|
template<typename Tag , typename T , StrongTypedefOps Ops, typename Enable , typename ValueType > |
std::enable_if_t< formats::common::kIsFormatValue< ValueType >, StrongTypedef< Tag, T, Ops, Enable > > | Parse (const ValueType &source, formats::parse::To< StrongTypedef< Tag, T, Ops, Enable > >) |
|
template<typename Tag , typename T , StrongTypedefOps Ops, typename Enable , typename TargetType > |
TargetType | Serialize (const StrongTypedef< Tag, T, Ops, Enable > &object, formats::serialize::To< TargetType >) |
|
template<typename Tag , typename T , StrongTypedefOps Ops, typename Enable , typename StringBuilder > |
void | WriteToStream (const StrongTypedef< Tag, T, Ops, Enable > &object, StringBuilder &sw) |
|
template<typename Tag , StrongTypedefOps Ops> |
std::string | ToString (const StrongTypedef< Tag, std::string, Ops > &object) |
|
template<typename Tag , typename T , StrongTypedefOps Ops, std::enable_if_t< meta::kIsInteger< T >, bool > = true> |
std::string | ToString (const StrongTypedef< Tag, T, Ops > &object) |
|
template<typename Target , typename Tag , typename T , StrongTypedefOps Ops, typename Enable > |
constexpr Target | StrongCast (const StrongTypedef< Tag, T, Ops, Enable > &src) |
|
template<typename Target , typename Tag , typename T , StrongTypedefOps Ops, typename Enable > |
constexpr Target | StrongCast (StrongTypedef< Tag, T, Ops, Enable > &&src) |
|
template<class Tag , class T , StrongTypedefOps Ops> |
std::size_t | hash_value (const StrongTypedef< Tag, T, Ops > &v) |
|
std::string | GetCurrentThreadName () |
| Get the name of the current thread.
|
|
void | SetCurrentThreadName (std::string_view name) |
| Set the name of the current thread.
|
|
bool | IsMainThread () noexcept |
|
void | SetCurrentThreadIdleScheduling () |
| Set priority of the OS thread to IDLE (the lowest one)
|
|
void | SetCurrentThreadLowPriorityScheduling () |
| Set priority of the OS thread to low (but not the lowest one)
|
|
template<typename BuilderFunc > |
| TrivialBiMap (BuilderFunc) -> TrivialBiMap< BuilderFunc > |
|
template<typename BuilderFunc > |
| TrivialSet (BuilderFunc) -> TrivialSet< BuilderFunc > |
|
template<typename ExceptionType = void, typename Value , typename BuilderFunc > |
auto | ParseFromValueString (const Value &value, TrivialBiMap< BuilderFunc > map) |
| Parses and returns whatever is specified by map from a formats::*::Value .
|
|
template<class T > |
constexpr auto | UnderlyingValue (T v) noexcept |
| Function that extracts integral value from enum or StrongTypedef.
|
|
template<typename Function , typename... Args> |
auto | CriticalAsync (engine::TaskProcessor &task_processor, std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | SharedCriticalAsync (engine::TaskProcessor &task_processor, std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | Async (engine::TaskProcessor &task_processor, std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | SharedAsync (engine::TaskProcessor &task_processor, std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | Async (engine::TaskProcessor &task_processor, std::string name, engine::Deadline deadline, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | SharedAsync (engine::TaskProcessor &task_processor, std::string name, engine::Deadline deadline, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | CriticalAsync (std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | SharedCriticalAsync (std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | Async (std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | SharedAsync (std::string name, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | Async (std::string name, engine::Deadline deadline, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | SharedAsync (std::string name, engine::Deadline deadline, Function &&f, Args &&... args) |
|
template<typename Function , typename... Args> |
auto | AsyncBackground (std::string name, engine::TaskProcessor &task_processor, Function &&f, Args &&... args) |
|
int | DaemonMain (int argc, const char *const argv[], const components::ComponentList &components_list) |
|
template<typename Cache > |
LazySharedPtr< typename Cache::DataType > | MakeLazyCachePtr (Cache &cache) |
| Make a lazy pointer to the data of a cache.
|
|
const char * | GetUserverVersion () noexcept |
|
const char * | GetUserverVcsRevision () noexcept |
|
const char * | GetUserverIdentifier () noexcept |
|
template<class Tag , class T , StrongTypedefOps Ops> |
void | PrintTo (const StrongTypedef< Tag, T, Ops > &v, std::ostream *os) |
|