diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 6c111abfd1e8..1dd50b82f64a 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -150,6 +150,7 @@ namespace std template struct aligned_storage; template struct aligned_union; + template struct remove_cvref; // C++20 template struct decay; template struct common_type; @@ -202,6 +203,8 @@ namespace std using aligned_storage_t = typename aligned_storage::type; // C++14 template using aligned_union_t = typename aligned_union::type; // C++14 + template + using remove_cvref_t = typename remove_cvref::type; // C++20 template using decay_t = typename decay::type; // C++14 template @@ -1141,6 +1144,17 @@ template struct __is_same_uncvref : is_same::type, typename __uncvref<_Up>::type> {}; +#if _LIBCPP_STD_VER > 17 +// aligned_union - same as __uncvref +template +struct remove_cvref { + using type = remove_cv_t>; +}; + +template using remove_cvref_t = typename remove_cvref<_Tp>::type; +#endif + + struct __any { __any(...); diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp new file mode 100644 index 000000000000..ebddeca607c4 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// type_traits + +// remove_cvref + +#include + +#include "test_macros.h" + +template +void test_remove_cvref() +{ + static_assert((std::is_same::type, U>::value), ""); + static_assert((std::is_same< std::remove_cvref_t, U>::value), ""); +} + +int main() +{ + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + +// Doesn't decay + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); + test_remove_cvref(); +} diff --git a/libcxx/www/cxx2a_status.html b/libcxx/www/cxx2a_status.html index 5adcecd2c9ed..f7076c15e068 100644 --- a/libcxx/www/cxx2a_status.html +++ b/libcxx/www/cxx2a_status.html @@ -64,7 +64,7 @@ P0415R1LWGConstexpr for std::complexAlbuquerque P0439R0LWGMake std::memory_order a scoped enumerationAlbuquerque P0457R2LWGString Prefix and Suffix CheckingAlbuquerque - P0550R2LWGTransformation Trait remove_cvrefAlbuquerque + P0550R2LWGTransformation Trait remove_cvrefAlbuquerqueComplete P0600R1LWGnodiscard in the LibraryAlbuquerque P0616R0LWGde-pessimize legacy algorithms with std::moveAlbuquerque P0653R2LWGUtility to convert a pointer to a raw pointerAlbuquerque