userver
C++ Async Framework
Loading...
Searching...
No Matches
variant.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/formats/serialize/variant.hpp
4
/// @brief Serializers for std::variant
5
/// @ingroup userver_universal userver_formats_serialize
6
7
#
include
<
variant
>
8
9
#
include
<
userver
/
formats
/
serialize
/
to
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
formats
::
serialize
{
14
15
template
<
typename
Value,
typename
... Types>
16
Value Serialize(
const
std::variant<Types...>& value,
To
<Value>) {
17
return
std::visit([](
const
auto
& item) {
return
typename
Value::Builder(item).ExtractValue(); }, value);
18
}
19
20
}
// namespace formats::serialize
21
22
USERVER_NAMESPACE_END
userver
formats
serialize
variant.hpp
Generated on Wed Dec 4 2024 18:50:17 for userver by
Doxygen
1.10.0