Tag: c++14
-
Are enum values allowed in a std::integer_sequence?
14 This code compiles and executes fine using GCC 13 and Clang 17, but fails to compile on MSVC. I am wondering if the code is required to work according to the standard or if this is a problem with MSVC. Demo #include <utility> #include <iostream> enum e : int { A=5, B, C, D…
-
Is it ok to use std::ignore in order to discard a return value of a function to avoid any related compiler warnings?
10 I know that you can use static_cast<void>, but it just seems too verbose for me, and not reflecting the original intent that I want to discard a return value, not to cast it to anything. Recently I stumbled upon std::ignore, which can accept a value of any type, the name is clear and readable,…
-
What is the purpose of _t aliases and _v variable templates for type traits?
7 There are a lot of *_v and *_t suffixes, like std::is_same_v, std::invoke_result_t, result_of_t and milions of other such functions. Why do they exist at all? Is it beneficial in any context to expose implementation details like std::result_of::type or std::is_same::value? Ignoring standard compliance, should the _v _t versions always be preferred? Could the ::type ::value…