13 #ifndef __STOUT_STRINGIFY_HPP__ 14 #define __STOUT_STRINGIFY_HPP__ 39 std::ostringstream out;
42 ABORT(
"Failed to stringify!");
51 inline std::string
stringify(
const std::string& str)
58 inline std::string
stringify(
const std::wstring& str)
61 static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t>
63 "UTF-16 to UTF-8 conversion failed",
64 L
"UTF-16 to UTF-8 conversion failed");
66 return converter.to_bytes(str);
70 inline std::wstring wide_stringify(
const std::string& str)
73 static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t>
75 "UTF-8 to UTF-16 conversion failed",
76 L
"UTF-8 to UTF-16 conversion failed");
78 return converter.from_bytes(str);
85 return b ?
"true" :
"false";
92 std::ostringstream out;
94 typename std::set<T>::const_iterator iterator =
set.begin();
95 while (iterator !=
set.end()) {
97 if (++iterator !=
set.end()) {
106 template <
typename T>
109 std::ostringstream out;
111 typename std::list<T>::const_iterator iterator = list.begin();
112 while (iterator != list.end()) {
114 if (++iterator != list.end()) {
123 template <
typename T>
126 std::ostringstream out;
128 typename std::vector<T>::const_iterator iterator = vector.begin();
129 while (iterator != vector.end()) {
131 if (++iterator != vector.end()) {
140 template <
typename K,
typename V>
143 std::ostringstream out;
145 typename std::map<K, V>::const_iterator iterator = map.begin();
146 while (iterator != map.end()) {
150 if (++iterator != map.end()) {
159 template <
typename T>
162 std::ostringstream out;
165 while (iterator !=
set.end()) {
167 if (++iterator !=
set.end()) {
176 template <
typename K,
typename V>
179 std::ostringstream out;
182 while (iterator != map.end()) {
186 if (++iterator != map.end()) {
204 #endif // __STOUT_STRINGIFY_HPP__ Definition: errorbase.hpp:36
#define ABORT(...)
Definition: abort.hpp:40
Definition: hashset.hpp:53
Definition: hashmap.hpp:38
Try< std::vector< Entry > > list(const std::string &hierarchy, const std::string &cgroup)
const std::string message
Definition: errorbase.hpp:46
Iterable< V > map(F &&f, const Iterable< U, Us... > &input)
Definition: lambda.hpp:46
std::string error(const std::string &msg, uint32_t code)
std::string stringify(const T &t)
Definition: stringify.hpp:37