| 123456789101112131415161718192021222324252627 |
- #pragma once
- namespace pointers { namespace detail {
- template <typename P, typename = void> struct get_ptr {
- decltype(std::declval<P>().get()) get(P const & ptr) const {
- return std::addressof(*ptr);
- }
- };
- template <typename T> struct get_ptr<std::weak_ptr<T>> {
- void get(std::weak_ptr<T> const & ptr) throw();
- };
- template <typename T> struct get_ptr<T *> {
- T * get(T * ptr) const { return ptr; }
- };
- template <typename P>
- struct get_ptr<P, typename std::enable_if<!std::is_void<decltype(
- std::declval<P>().get())>::value>::type> {
- decltype(std::declval<P>().get()) get(P const & ptr) const {
- return ptr.get();
- }
- };
- }}
|