trying to fix strange AppleClang compiler error

This commit is contained in:
Mike Zozu 2020-12-15 16:58:38 +03:00
parent 6964cccd2f
commit 5572cb0862

View File

@ -94,10 +94,6 @@ constexpr size_t repr_max_container_size = 5;
template <typename T> std::string repr(T const &val) { template <typename T> std::string repr(T const &val) {
if constexpr (std::is_convertible_v<T, std::string_view>) { if constexpr (std::is_convertible_v<T, std::string_view>) {
return '"' + std::string{std::string_view{val}} + '"'; return '"' + std::string{std::string_view{val}} + '"';
} else if constexpr (is_streamable_v<T>) {
std::stringstream out;
out << val;
return out.str();
} else if constexpr (is_container_v<T>) { } else if constexpr (is_container_v<T>) {
std::stringstream out; std::stringstream out;
out << "{"; out << "{";
@ -117,6 +113,10 @@ template <typename T> std::string repr(T const &val) {
out << repr(*std::prev(val.end())); out << repr(*std::prev(val.end()));
out << "}"; out << "}";
return out.str(); return out.str();
} else if constexpr (is_streamable_v<T>) {
std::stringstream out;
out << val;
return out.str();
} else { } else {
return "<not representable>"; return "<not representable>";
} }