From 17aced0a546331763cb211027c454fc0930d1f45 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 19 May 2022 16:54:44 +0200 Subject: [PATCH] Define xbt::type_identity_t (similar to C++20's std::type_identity_t). --- include/xbt/utility.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/xbt/utility.hpp b/include/xbt/utility.hpp index d0d73022ff..03458064d3 100644 --- a/include/xbt/utility.hpp +++ b/include/xbt/utility.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include /** @brief Helper macro to declare enum class @@ -29,6 +30,18 @@ namespace simgrid { namespace xbt { +/** @brief Replacement for C++20's std::type_identity_t + */ +#if __cplusplus >= 201806L // __cpp_lib_type_identity +template using type_identity_t = typename std::type_identity_t; +#else +template struct type_identity { + using type = T; +}; + +template using type_identity_t = typename type_identity::type; +#endif + /** @brief A hash which works with more stuff * * It can hash pairs: the standard hash currently doesn't include this. -- 2.20.1