mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 06:21:00 +00:00
Replace internal::get with std::declval
This commit is contained in:
parent
53cf073561
commit
be887d9269
@ -1046,9 +1046,6 @@ struct null {};
|
|||||||
typedef char yes[1];
|
typedef char yes[1];
|
||||||
typedef char no[2];
|
typedef char no[2];
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T &get();
|
|
||||||
|
|
||||||
yes &convert(unsigned long long);
|
yes &convert(unsigned long long);
|
||||||
no &convert(...);
|
no &convert(...);
|
||||||
|
|
||||||
@ -1073,7 +1070,9 @@ struct convert_to_int_impl2<T, true> {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct convert_to_int {
|
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 };
|
enum { value = convert_to_int_impl2<T, enable_conversion>::value };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@ template<typename T>
|
|||||||
struct convert_to_int_impl<T, true> {
|
struct convert_to_int_impl<T, true> {
|
||||||
// Convert to int only if T doesn't have an overloaded operator<<.
|
// Convert to int only if T doesn't have an overloaded operator<<.
|
||||||
enum {
|
enum {
|
||||||
value = sizeof(convert(get<DummyStream>() << get<T>())) == sizeof(no)
|
value = sizeof(convert(std::declval<DummyStream&>() << std::declval<T>()))
|
||||||
|
== sizeof(no)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user