mirror of git://gcc.gnu.org/git/gcc.git
Use aliases for type traits in C++14 mode.
* include/bits/unique_ptr.h (make_unique): Use alias for trait. * include/experimental/optional (__constexpr_addressof): Likewise. (_Optional_base, optional, make_optional): Likewise. From-SVN: r217064
This commit is contained in:
parent
fc628a8153
commit
8a57bed1d6
|
|
@ -1,3 +1,9 @@
|
||||||
|
2014-11-04 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
* include/bits/unique_ptr.h (make_unique): Use alias for trait.
|
||||||
|
* include/experimental/optional (__constexpr_addressof): Likewise.
|
||||||
|
(_Optional_base, optional, make_optional): Likewise.
|
||||||
|
|
||||||
2014-11-03 Paolo Carlini <paolo.carlini@oracle.com>
|
2014-11-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
* include/parallel/algo.h: Do not use default arguments in function
|
* include/parallel/algo.h: Do not use default arguments in function
|
||||||
|
|
|
||||||
|
|
@ -768,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline typename _MakeUniq<_Tp>::__array
|
inline typename _MakeUniq<_Tp>::__array
|
||||||
make_unique(size_t __num)
|
make_unique(size_t __num)
|
||||||
{ return unique_ptr<_Tp>(new typename remove_extent<_Tp>::type[__num]()); }
|
{ return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); }
|
||||||
|
|
||||||
/// Disable std::make_unique for arrays of known bound
|
/// Disable std::make_unique for arrays of known bound
|
||||||
template<typename _Tp, typename... _Args>
|
template<typename _Tp, typename... _Args>
|
||||||
|
|
|
||||||
|
|
@ -151,16 +151,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
* overloaded addressof operator (unary operator&), in which case the call
|
* overloaded addressof operator (unary operator&), in which case the call
|
||||||
* will not be a constant expression.
|
* will not be a constant expression.
|
||||||
*/
|
*/
|
||||||
template<typename _Tp, typename enable_if<!_Has_addressof<_Tp>::value,
|
template<typename _Tp, enable_if_t<!_Has_addressof<_Tp>::value, int>...>
|
||||||
int>::type...>
|
|
||||||
constexpr _Tp* __constexpr_addressof(_Tp& __t)
|
constexpr _Tp* __constexpr_addressof(_Tp& __t)
|
||||||
{ return &__t; }
|
{ return &__t; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fallback overload that defers to __addressof.
|
* @brief Fallback overload that defers to __addressof.
|
||||||
*/
|
*/
|
||||||
template<typename _Tp, typename enable_if<_Has_addressof<_Tp>::value,
|
template<typename _Tp, enable_if_t<_Has_addressof<_Tp>::value, int>...>
|
||||||
int>::type...>
|
|
||||||
inline _Tp* __constexpr_addressof(_Tp& __t)
|
inline _Tp* __constexpr_addressof(_Tp& __t)
|
||||||
{ return std::__addressof(__t); }
|
{ return std::__addressof(__t); }
|
||||||
|
|
||||||
|
|
@ -184,7 +182,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
// Remove const to avoid prohibition of reusing object storage for
|
// Remove const to avoid prohibition of reusing object storage for
|
||||||
// const-qualified types in [3.8/9]. This is strictly internal
|
// const-qualified types in [3.8/9]. This is strictly internal
|
||||||
// and even optional itself is oblivious to it.
|
// and even optional itself is oblivious to it.
|
||||||
using _Stored_type = typename remove_const<_Tp>::type;
|
using _Stored_type = remove_const_t<_Tp>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// [X.Y.4.1] Constructors.
|
// [X.Y.4.1] Constructors.
|
||||||
|
|
@ -208,10 +206,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
|
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
|
||||||
|
|
||||||
template<typename _Up, typename... _Args,
|
template<typename _Up, typename... _Args,
|
||||||
typename enable_if<is_constructible<_Tp,
|
enable_if_t<is_constructible<_Tp,
|
||||||
initializer_list<_Up>&,
|
initializer_list<_Up>&,
|
||||||
_Args&&...>::value,
|
_Args&&...>::value,
|
||||||
int>::type...>
|
int>...>
|
||||||
constexpr explicit _Optional_base(in_place_t,
|
constexpr explicit _Optional_base(in_place_t,
|
||||||
initializer_list<_Up> __il,
|
initializer_list<_Up> __il,
|
||||||
_Args&&... __args)
|
_Args&&... __args)
|
||||||
|
|
@ -330,7 +328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
class _Optional_base<_Tp, false>
|
class _Optional_base<_Tp, false>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using _Stored_type = typename remove_const<_Tp>::type;
|
using _Stored_type = remove_const_t<_Tp>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr _Optional_base() noexcept
|
constexpr _Optional_base() noexcept
|
||||||
|
|
@ -350,10 +348,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
|
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
|
||||||
|
|
||||||
template<typename _Up, typename... _Args,
|
template<typename _Up, typename... _Args,
|
||||||
typename enable_if<is_constructible<_Tp,
|
enable_if_t<is_constructible<_Tp,
|
||||||
initializer_list<_Up>&,
|
initializer_list<_Up>&,
|
||||||
_Args&&...>::value,
|
_Args&&...>::value,
|
||||||
int>::type...>
|
int>...>
|
||||||
constexpr explicit _Optional_base(in_place_t,
|
constexpr explicit _Optional_base(in_place_t,
|
||||||
initializer_list<_Up> __il,
|
initializer_list<_Up> __il,
|
||||||
_Args&&... __args)
|
_Args&&... __args)
|
||||||
|
|
@ -472,10 +470,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
// Unique tag type.
|
// Unique tag type.
|
||||||
optional<_Tp>>
|
optional<_Tp>>
|
||||||
{
|
{
|
||||||
static_assert(__and_<__not_<is_same<typename remove_cv<_Tp>::type,
|
static_assert(__and_<__not_<is_same<remove_cv_t<_Tp>, nullopt_t>>,
|
||||||
nullopt_t>>,
|
__not_<is_same<remove_cv_t<_Tp>, in_place_t>>,
|
||||||
__not_<is_same<typename remove_cv<_Tp>::type,
|
|
||||||
in_place_t>>,
|
|
||||||
__not_<is_reference<_Tp>>>(),
|
__not_<is_reference<_Tp>>>(),
|
||||||
"Invalid instantiation of optional<T>");
|
"Invalid instantiation of optional<T>");
|
||||||
|
|
||||||
|
|
@ -497,10 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Up>
|
template<typename _Up>
|
||||||
typename enable_if<
|
enable_if_t<is_same<_Tp, decay_t<_Up>>::value, optional&>
|
||||||
is_same<_Tp, typename decay<_Up>::type>::value,
|
|
||||||
optional&
|
|
||||||
>::type
|
|
||||||
operator=(_Up&& __u)
|
operator=(_Up&& __u)
|
||||||
{
|
{
|
||||||
static_assert(__and_<is_constructible<_Tp, _Up>,
|
static_assert(__and_<is_constructible<_Tp, _Up>,
|
||||||
|
|
@ -527,11 +520,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Up, typename... _Args>
|
template<typename _Up, typename... _Args>
|
||||||
typename enable_if<
|
enable_if_t<is_constructible<_Tp, initializer_list<_Up>&,
|
||||||
is_constructible<_Tp,
|
_Args&&...>::value>
|
||||||
initializer_list<_Up>&,
|
|
||||||
_Args&&...>::value
|
|
||||||
>::type
|
|
||||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||||
{
|
{
|
||||||
this->_M_reset();
|
this->_M_reset();
|
||||||
|
|
@ -795,9 +785,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
{ __lhs.swap(__rhs); }
|
{ __lhs.swap(__rhs); }
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
constexpr optional<typename decay<_Tp>::type>
|
constexpr optional<decay_t<_Tp>>
|
||||||
make_optional(_Tp&& __t)
|
make_optional(_Tp&& __t)
|
||||||
{ return optional<typename decay<_Tp>::type> { std::forward<_Tp>(__t) }; }
|
{ return optional<decay_t<_Tp>> { std::forward<_Tp>(__t) }; }
|
||||||
|
|
||||||
// @} group optional
|
// @} group optional
|
||||||
_GLIBCXX_END_NAMESPACE_VERSION
|
_GLIBCXX_END_NAMESPACE_VERSION
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue