Date: Sun, 29 Aug 2021 02:19:16 +0800
Hi C++ expert,
I have been wondering why we have std::index_sequence but not
std::size_constant, that is:
template<std::size_t N>
using size_constant = std::integral_constant<std::size_t, N>;
Since std::integral_constant<std::size_t, N> is widely used in the standard
library, such as tuple_size and variant_size need to inherit it, so I think
it is appropriate to add an alias to it in the standard, which can reduce a
lot of typing and improve some readability, just like we aliased
bool_constant<b> to integral_constant<bool, b>.
Any idea? Or is it that some paper has already proposed it?
Hewill
I have been wondering why we have std::index_sequence but not
std::size_constant, that is:
template<std::size_t N>
using size_constant = std::integral_constant<std::size_t, N>;
Since std::integral_constant<std::size_t, N> is widely used in the standard
library, such as tuple_size and variant_size need to inherit it, so I think
it is appropriate to add an alias to it in the standard, which can reduce a
lot of typing and improve some readability, just like we aliased
bool_constant<b> to integral_constant<bool, b>.
Any idea? Or is it that some paper has already proposed it?
Hewill
Received on 2021-08-28 13:19:29