Last active
December 17, 2015 01:38
-
-
Save kikairoya/5529538 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
namespace detail { | |
template <typename T> | |
struct identity { typedef T type; }; | |
template <typename T> | |
struct has_overloaded_address_operator_impl { | |
template <typename U> | |
static std::true_type check(U *p, identity<decltype(p->operator &())> * = 0); | |
template <typename U> | |
static std::true_type check(U *p, identity<decltype(operator &(*p))> * = 0); | |
static std::false_type check(const volatile void *); | |
typedef decltype(check((T *)0)) type; | |
}; | |
} | |
template <typename T> | |
struct has_overloaded_address_operator: detail::has_overloaded_address_operator_impl<T>::type { }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment