commit ff058a39a42e886b8db71677d735c37621d70f14
parent d65dff134f3b40c069cf508c915d2adfec1acb9b
Author: [email protected] <[email protected]>
Date: Tue, 26 Jul 2016 15:51:32 +0300
CoMeta: repr() for std::pair
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/kfr/cometa/string.hpp b/include/kfr/cometa/string.hpp
@@ -4,6 +4,7 @@
#include <array>
#include <cstdio>
#include <string>
+#include <utility>
#pragma clang diagnostic push
#if CID_HAS_WARNING("-Wformat-security")
@@ -29,6 +30,12 @@ inline std::string repr(const named_arg<T>& value)
return std::string(value.name) + " = " + as_string(value.value);
}
+template <typename T1, typename T2>
+inline std::string repr(const std::pair<T1, T2>& value)
+{
+ return "(" + as_string(value.first) + "; " + as_string(value.second) + ")";
+}
+
template <typename T>
using repr_type = decay<decltype(repr(std::declval<T>()))>;