userver: userver/utils/optionals.hpp File Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
optionals.hpp File Reference

Detailed Description

Helper functions for std optionals.

Definition in file optionals.hpp.

Go to the source code of this file.

#include <optional>
#include <string>
#include <utility>
#include <fmt/compile.h>
#include <fmt/format.h>
+ Include dependency graph for optionals.hpp:

Namespaces

namespace  utils
 Utilities.
 

Functions

template<class T >
std::string utils::ToString (const std::optional< T > &from)
 Converts std::optional to a string, empty value represented as "--".
 
template<typename T , typename Func >
auto utils::OptionalTransform (T &&opt, Func func) -> std::optional< decltype(std::move(func)(*std::forward< T >(opt)))>
 A polyfill for C++23 monadic operations for std::optional.