Zen C++ Libraries
Zero-dependency re-usable components for C++
Loading...
Searching...
No Matches
include
zen
formatting.hpp
1
2
#include <concepts>
3
#include <ostream>
4
#include <sstream>
5
6
#include "zen/config.hpp"
7
8
ZEN_NAMESPACE_START
9
10
template
<
typename
T>
11
concept
has_display
=
requires
(T
value
, std::ostream& out) {
12
{
value
.display(out) } -> std::same_as<void>;
13
};
14
15
template
<
typename
T>
16
std::string display(
const
T&
value
);
17
18
template
<has_display T>
19
std::string display(
const
T&
value
) {
20
std::ostringstream out;
21
value
.display(out);
22
return
out.str();
23
}
24
25
ZEN_NAMESPACE_END
value
Definition
value.hpp:34
has_display
Definition
formatting.hpp:11
Generated by
1.15.0