You can add const-ness to the type easily enough, because cv-qualifiers modify the type:
template <typename T>
using T_C = std::add_const_t<T>;
However, static
and constexpr
modify declarations, rather than types. So, here:
int x1;
const int x2;
static const int x3;
static constexpr const int x4;
// | ^ | type |name
// ^ | constexpr specifier
// storage class specifier
the last three declarations are all of type const int
, but x2
has different storage class to x3
and x4
.
Honestly, if the main problem is that
... it's really boring to write ...
my best suggestion is that you learn how to write macros or save common code snippets in your preferred editor.