xrpld
Loading...
Searching...
No Matches
ToString.h
1#pragma once
2
3#include <string>
4#include <type_traits>
5
6namespace xrpl {
7
13
14template <class T>
15std::enable_if_t<std::is_arithmetic_v<T>, std::string>
16to_string(T t) // NOLINT(readability-identifier-naming)
17{
18 return std::to_string(t);
19}
20
21inline std::string
22to_string(bool b) // NOLINT(readability-identifier-naming)
23{
24 return b ? "true" : "false";
25}
26
27inline std::string
28to_string(char c) // NOLINT(readability-identifier-naming)
29{
30 return std::string(1, c);
31}
32
33inline std::string
34to_string(std::string s) // NOLINT(readability-identifier-naming)
35{
36 return s;
37}
38
39inline std::string
40to_string(char const* s) // NOLINT(readability-identifier-naming)
41{
42 return s;
43}
44
45} // namespace xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition base_uint.h:633
T to_string(T... args)