1
0
forked from boostorg/core

Only checking BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION is sufficient

This commit is contained in:
Glen Fernandes
2018-01-27 09:42:02 -05:00
parent 23f10ab4bf
commit dbb3305050
3 changed files with 5 additions and 18 deletions

View File

@@ -121,7 +121,8 @@ namespace boost {
[[Returns] [[Returns]
[A pointer of type `element_type*` that references the same location as the [A pointer of type `element_type*` that references the same location as the
argument `p`.]] argument `p`.]]
[[Note] [This function should be the inverse of `pointer_to`. If defined, it [[Note]
[This function should be the inverse of `pointer_to`. If defined, it
customizes the behavior of the non-member function `to_address`.]]]]]] customizes the behavior of the non-member function `to_address`.]]]]]]
[endsect] [endsect]

View File

@@ -186,8 +186,7 @@ to_address(T* v) BOOST_NOEXCEPT
return v; return v;
} }
#if !defined(BOOST_NO_CXX11_SFINAE_EXPR) && \ #if !defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
!defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
namespace detail { namespace detail {
template<class T> template<class T>

View File

@@ -32,8 +32,7 @@ private:
P1<T> p_; P1<T> p_;
}; };
#if !defined(BOOST_NO_CXX11_SFINAE_EXPR) && \ #if !defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
!defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
template<class T> template<class T>
class P3 { class P3 {
public: public:
@@ -47,14 +46,12 @@ private:
}; };
namespace boost { namespace boost {
template<class T> template<class T>
struct pointer_traits<P3<T> > { struct pointer_traits<P3<T> > {
static T* to_address(const P3<T>& p) BOOST_NOEXCEPT { static T* to_address(const P3<T>& p) BOOST_NOEXCEPT {
return p.get(); return p.get();
} }
}; };
} /* boost */ } /* boost */
template<class T> template<class T>
@@ -73,14 +70,12 @@ private:
}; };
namespace boost { namespace boost {
template<class T> template<class T>
struct pointer_traits<P4<T> > { struct pointer_traits<P4<T> > {
static T* to_address(const P4<T>& p) BOOST_NOEXCEPT { static T* to_address(const P4<T>& p) BOOST_NOEXCEPT {
return p.get(); return p.get();
} }
}; };
} /* boost */ } /* boost */
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS) #if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
@@ -97,14 +92,12 @@ private:
}; };
namespace std { namespace std {
template<class T> template<class T>
struct pointer_traits<P5<T> > { struct pointer_traits<P5<T> > {
static T* to_address(const P5<T>& p) BOOST_NOEXCEPT { static T* to_address(const P5<T>& p) BOOST_NOEXCEPT {
return p.get(); return p.get();
} }
}; };
} /* std */ } /* std */
template<class T> template<class T>
@@ -120,27 +113,22 @@ private:
}; };
namespace boost { namespace boost {
template<class T> template<class T>
struct pointer_traits<P6<T> > { struct pointer_traits<P6<T> > {
static T* to_address(const P6<T>& p) BOOST_NOEXCEPT { static T* to_address(const P6<T>& p) BOOST_NOEXCEPT {
return p.get(); return p.get();
} }
}; };
} /* boost */ } /* boost */
namespace std { namespace std {
template<class T> template<class T>
struct pointer_traits<P6<T> > { struct pointer_traits<P6<T> > {
static T* to_address(const P6<T>& p) BOOST_NOEXCEPT { static T* to_address(const P6<T>& p) BOOST_NOEXCEPT {
return 0; return 0;
} }
}; };
} /* std */ } /* std */
#endif #endif
#endif #endif
@@ -154,8 +142,7 @@ int main()
BOOST_TEST(boost::to_address(p1) == &i); BOOST_TEST(boost::to_address(p1) == &i);
P2<int> p2(&i); P2<int> p2(&i);
BOOST_TEST(boost::to_address(p2) == &i); BOOST_TEST(boost::to_address(p2) == &i);
#if !defined(BOOST_NO_CXX11_SFINAE_EXPR) && \ #if !defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
!defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
P3<int> p3(&i); P3<int> p3(&i);
BOOST_TEST(boost::to_address(p3) == &i); BOOST_TEST(boost::to_address(p3) == &i);
P4<int> p4(&i); P4<int> p4(&i);