From: Arnaud Giersch Date: Tue, 23 May 2023 12:26:38 +0000 (+0200) Subject: Use the "_t" and "_v" version of type traits. X-Git-Tag: v3.34~109^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2865125a12cae86515e21999f32efe33de513646 Use the "_t" and "_v" version of type traits. --- diff --git a/doc/doxygen/uhood_switch.doc b/doc/doxygen/uhood_switch.doc index dc4036766b..98d55a9c47 100644 --- a/doc/doxygen/uhood_switch.doc +++ b/doc/doxygen/uhood_switch.doc @@ -411,7 +411,7 @@ type and properly handles exceptions: @code{cpp} template -typename std::result_of::type kernelImmediate(F&& code) +typename std::result_of_t kernelImmediate(F&& code) { // If we are in the simulation kernel, we take the fast path and // execute the code directly without simcall @@ -421,7 +421,7 @@ typename std::result_of::type kernelImmediate(F&& code) // If we are in the application, pass the code to the simulation // kernel which executes it for us and reports the result: - typedef typename std::result_of::type R; + typedef typename std::result_of_t R; simgrid::xbt::Result result; simcall_run_kernel([&]{ xbt_assert(SIMIX_is_maestro(), "Not in maestro"); diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index 7dd0196d0c..beff27c9f5 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -192,7 +192,7 @@ public: /** @brief Retrieves all netzones of the type indicated by the template argument */ template std::vector get_filtered_netzones() const { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "Filtering netzones is only possible for subclasses of kernel::routing::NetZoneImpl"); std::vector res; get_filtered_netzones_recursive(get_netzone_root(), &res); @@ -271,7 +271,7 @@ std::vector create_DAG_from_json(const std::string& filename); template XBT_PRIVATE void get_filtered_netzones_recursive(const s4u::NetZone* current, std::vector* whereto) { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "Filtering netzones is only possible for subclasses of kernel::routing::NetZoneImpl"); for (auto const& elem : current->get_children()) { get_filtered_netzones_recursive(elem, whereto); diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 8c2d35e549..589c8dce49 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -139,7 +139,7 @@ void bind_flag(T& value, const char* name, std::initializer_list al */ // F is a checker, F : T& -> () template -typename std::enable_if_t()(std::declval()))>::value, void> +typename std::enable_if_t()(std::declval()))>, void> bind_flag(T& value, const char* name, const char* description, F callback) { declare_flag(name, description, value, std::function([&value, callback](const T& val) { @@ -149,7 +149,7 @@ bind_flag(T& value, const char* name, const char* description, F callback) } template -typename std::enable_if_t()(std::declval()))>::value, void> +typename std::enable_if_t()(std::declval()))>, void> bind_flag(T& value, const char* name, std::initializer_list aliases, const char* description, F callback) { bind_flag(value, name, description, std::move(callback)); @@ -157,8 +157,7 @@ bind_flag(T& value, const char* name, std::initializer_list aliases } template -typename std::enable_if_t()(std::declval()))>::value, - void> +typename std::enable_if_t()(std::declval()))>, void> bind_flag(std::string& value, const char* name, const char* description, const std::map>& valid_values, F callback) { @@ -180,8 +179,7 @@ bind_flag(std::string& value, const char* name, const char* description, })); } template -typename std::enable_if_t()(std::declval()))>::value, - void> +typename std::enable_if_t()(std::declval()))>, void> bind_flag(std::string& value, const char* name, std::initializer_list aliases, const char* description, const std::map>& valid_values, F callback) { @@ -198,7 +196,7 @@ bind_flag(std::string& value, const char* name, std::initializer_list bool template -typename std::enable_if_t()(std::declval()))>::value, void> +typename std::enable_if_t()(std::declval()))>, void> bind_flag(T& value, const char* name, const char* description, F callback) { declare_flag(name, description, value, std::function([&value, callback](const T& val) { diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index ea8535b944..9d1b337c49 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -73,12 +73,12 @@ constexpr auto apply(F&& f, Tuple&& t, std::index_sequence) * @endcode **/ template -constexpr auto apply(F&& f, Tuple&& t) -> decltype( - simgrid::xbt::bits::apply(std::forward(f), std::forward(t), - std::make_index_sequence>::value>())) +constexpr auto apply(F&& f, Tuple&& t) + -> decltype(simgrid::xbt::bits::apply(std::forward(f), std::forward(t), + std::make_index_sequence>>())) { return simgrid::xbt::bits::apply(std::forward(f), std::forward(t), - std::make_index_sequence>::value>()); + std::make_index_sequence>>()); } template class Task; @@ -178,7 +178,7 @@ private: return code(std::forward(args)...); }, // Destroy: - std::is_trivially_destructible::value ? + std::is_trivially_destructible_v ? static_cast(nullptr) : [](TaskUnion& buffer) { auto* code = reinterpret_cast(&buffer); diff --git a/src/kernel/lmm/bmf.cpp b/src/kernel/lmm/bmf.cpp index a754fd5dec..d6950bf3b8 100644 --- a/src/kernel/lmm/bmf.cpp +++ b/src/kernel/lmm/bmf.cpp @@ -85,7 +85,7 @@ template std::string BmfSolver::debug_vector(const C& container) co { std::stringstream debug; std::copy(container.begin(), container.end(), - std::ostream_iterator::type::value_type>(debug, " ")); + std::ostream_iterator::value_type>(debug, " ")); return debug.str(); } diff --git a/src/mc/remote/RemotePtr.hpp b/src/mc/remote/RemotePtr.hpp index 29007105d3..16efc9354b 100644 --- a/src/mc/remote/RemotePtr.hpp +++ b/src/mc/remote/RemotePtr.hpp @@ -37,7 +37,7 @@ public: std::size_t get_buffer_size() const { return sizeof(T); } operator T() const { - static_assert(std::is_trivial::value, "Cannot convert non trivial type"); + static_assert(std::is_trivial_v, "Cannot convert non trivial type"); return *get_buffer(); } void clear() { std::memset(&buffer, 0, sizeof buffer); } diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 93ca639a0c..c743864e7e 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -39,7 +39,7 @@ template inline void hash_combine(std::size_t& seed, T const& v) } // Recursive template code derived from Matthieu M. -template ::value - 1> class HashValueImpl { +template - 1> class HashValueImpl { public: static void apply(size_t& seed, Tuple const& tuple) {