blob: 55f608c3b6059fac3f163eb1a5eb6bdf1d50bb06 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#include <library/cpp/yt/misc/tag_invoke_cpo.h>
#include <util/generic/strbuf.h>
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
// NB(arkady-e1ppa): This file intentionally is unaware of possible "yson-implementations"
// e.g. INode and TYsonString(Buf). This is done for two reasons:
// 1) We can't have dep on INodePtr here anyway.
// 2) We would like to eventually remove dep on yson of this module.
////////////////////////////////////////////////////////////////////////////////
// NB(arkady-e1ppa): We intentionally generate a separate namespace
// where ConvertToImpl functions would reside
// without polluting general-use namespaces.
namespace NConvertToImpl {
template <class T>
struct TFn : public NYT::TTagInvokeCpoBase<TFn<T>>
{ };
} // NConvertToImpl
////////////////////////////////////////////////////////////////////////////////
template <class T>
inline constexpr NConvertToImpl::TFn<T> ConvertTo = {};
////////////////////////////////////////////////////////////////////////////////
template <class TTo, class TFrom>
concept CConvertToWorks = requires (const TFrom& from) {
{ NYT::ConvertTo<TTo>(from) } -> std::same_as<TTo>;
};
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|