Replace a bunch of craft with type_traits

This commit is contained in:
Victor Zverovich
2018-01-21 18:11:57 -08:00
parent 3a6c7d0cbd
commit e79588d6c1
3 changed files with 9 additions and 53 deletions
+4 -14
View File
@@ -47,22 +47,12 @@ class FormatBuf : public std::basic_streambuf<Char> {
}
};
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> {
template <typename T>
struct convert_to_int<T,
sizeof(std::declval<std::ostream>() << std::declval<T>()) != 0> {
// Convert to int only if T doesn't have an overloaded operator<<.
enum {
value = sizeof(convert(std::declval<DummyStream&>() << std::declval<T>()))
== sizeof(no)
value = false
};
};