summaryrefslogtreecommitdiff
path: root/include/type_traits
diff options
context:
space:
mode:
Diffstat (limited to 'include/type_traits')
-rw-r--r--include/type_traits100
1 files changed, 17 insertions, 83 deletions
diff --git a/include/type_traits b/include/type_traits
index 13129f31d665..a54e25204eeb 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -163,22 +163,15 @@ struct __two {char _[2];};
template <class _Tp, _Tp __v>
struct _LIBCPP_VISIBLE integral_constant
{
- static constexpr _Tp value = __v;
+ static _LIBCPP_CONSTEXPR const _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant type;
_LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
- constexpr
-#endif
- operator value_type()
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
- const
-#endif
- {return value;}
+ _LIBCPP_CONSTEXPR operator value_type() const {return value;}
};
template <class _Tp, _Tp __v>
-constexpr _Tp integral_constant<_Tp, __v>::value;
+_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
@@ -1305,24 +1298,8 @@ forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-class __rv
-{
- typedef typename remove_reference<_Tp>::type _Trr;
- _Trr& t_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- _Trr* operator->() {return &t_;}
- _LIBCPP_INLINE_VISIBILITY
- explicit __rv(_Trr& __t) : t_(__t) {}
-};
-
-template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_convertible<_Tp, __rv<_Tp> >::value,
- _Tp&
->::type
+_Tp&
move(_Tp& __t)
{
return __t;
@@ -1330,11 +1307,7 @@ move(_Tp& __t)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_convertible<_Tp, __rv<_Tp> >::value,
- const _Tp&
->::type
+const _Tp&
move(const _Tp& __t)
{
return __t;
@@ -1342,63 +1315,24 @@ move(const _Tp& __t)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_convertible<_Tp, __rv<_Tp> >::value,
- _Tp
->::type
-move(_Tp& __t)
-{
- return _Tp(__rv<_Tp>(__t));
-}
-
-template <class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_convertible<_Tp, __rv<_Tp> >::value,
- typename add_lvalue_reference<_Tp>::type
->::type
-forward(_Up& __t)
-{
- return __t;
-}
-
-template <class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_convertible<_Tp, __rv<_Tp> >::value,
- typename add_lvalue_reference<_Tp>::type
->::type
-forward(const _Up& __t)
+_Tp&
+forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
{
return __t;
}
-template <class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_convertible<_Tp, __rv<_Tp> >::value,
- _Tp
->::type
-forward(_Up& __t)
-{
- return _Tp(__rv<_Tp>(__t));
-}
-template <class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_convertible<_Tp, __rv<_Tp> >::value,
- _Tp
->::type
-forward(const _Up& __t)
+template <class _Tp>
+class __rv
{
- return _Tp(__rv<_Tp>(__t));
-}
+ typedef typename remove_reference<_Tp>::type _Trr;
+ _Trr& t_;
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ _Trr* operator->() {return &t_;}
+ _LIBCPP_INLINE_VISIBILITY
+ explicit __rv(_Trr& __t) : t_(__t) {}
+};
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES