userver: userver/utils/optionals.hpp File Reference
Loading...
Searching...
No Matches
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.