Revert "Replace a bunch of craft with type_traits"

This reverts commit e79588d6c1.
This commit is contained in:
Victor Zverovich
2018-01-21 18:53:38 -08:00
parent 0473c48f88
commit 21429c8646
3 changed files with 54 additions and 10 deletions
+14 -4
View File
@@ -47,12 +47,22 @@ class FormatBuf : public std::basic_streambuf<Char> {
}
};
template <typename T>
struct convert_to_int<T,
sizeof(std::declval<std::ostream>() << std::declval<T>()) != 0> {
yes &convert(std::ostream &);
struct DummyStream : std::ostream {
DummyStream(); // Suppress a bogus warning in MSVC.
// Hide all operator<< overloads from std::ostream.
void operator<<(null<>);
};
no &operator<<(std::ostream &, int);
template<typename T>
struct convert_to_int_impl<T, true> {
// Convert to int only if T doesn't have an overloaded operator<<.
enum {
value = false
value = sizeof(convert(std::declval<DummyStream&>() << std::declval<T>()))
== sizeof(no)
};
};