Replace internal::get with std::declval

This commit is contained in:
Victor Zverovich 2017-09-08 08:09:28 -07:00
parent 53cf073561
commit be887d9269
2 changed files with 5 additions and 5 deletions

View File

@ -1046,9 +1046,6 @@ struct null {};
typedef char yes[1];
typedef char no[2];
template <typename T>
T &get();
yes &convert(unsigned long long);
no &convert(...);
@ -1073,7 +1070,9 @@ struct convert_to_int_impl2<T, true> {
template<typename T>
struct convert_to_int {
enum { enable_conversion = sizeof(convert(get<T>())) == sizeof(yes) };
enum {
enable_conversion = sizeof(convert(std::declval<T>())) == sizeof(yes)
};
enum { value = convert_to_int_impl2<T, enable_conversion>::value };
};

View File

@ -63,7 +63,8 @@ template<typename T>
struct convert_to_int_impl<T, true> {
// Convert to int only if T doesn't have an overloaded operator<<.
enum {
value = sizeof(convert(get<DummyStream>() << get<T>())) == sizeof(no)
value = sizeof(convert(std::declval<DummyStream&>() << std::declval<T>()))
== sizeof(no)
};
};