[v2,7/8] Use C++17 void_t

Message ID 20231121152817.31859-8-tom@tromey.com
State New
Headers
Series [v2,1/8] Use C++17 [[fallthrough]] attribute |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Testing failed

Commit Message

Tom Tromey Nov. 21, 2023, 3:27 p.m. UTC
  C++17 has void_t and make_void, so gdbsupport/traits.h can be
simplified.

Approved-By: Pedro Alves <pedro@palves.net>
---
 gdbsupport/traits.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
  

Patch

diff --git a/gdbsupport/traits.h b/gdbsupport/traits.h
index f6bb64911be..277e117bead 100644
--- a/gdbsupport/traits.h
+++ b/gdbsupport/traits.h
@@ -43,15 +43,6 @@ 
 
 namespace gdb {
 
-/* Pre C++14-safe (CWG 1558) version of C++17's std::void_t.  See
-   <http://en.cppreference.com/w/cpp/types/void_t>.  */
-
-template<typename... Ts>
-struct make_void { typedef void type; };
-
-template<typename... Ts>
-using void_t = typename make_void<Ts...>::type;
-
 /* Implementation of the detection idiom:
 
    - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf
@@ -79,7 +70,7 @@  struct detector
 
 /* Implementation of the detection idiom (positive case).  */
 template<typename Default, template<typename...> class Op, typename... Args>
-struct detector<Default, void_t<Op<Args...>>, Op, Args...>
+struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
 {
   using value_t = std::true_type;
   using type = Op<Args...>;