integer_sequence should have a self-typedef ::typeSection: 21.2.2 [intseq.intseq] Status: NAD Submitter: Stephan T. Lavavej Opened: 2013-11-01 Last modified: 2016-01-28
Priority: 2
View all issues with NAD status.
Discussion:
21.3.4 [meta.help] says that integral_constant<T, v> provides ::value_type (for T)
and ::type (for itself).
integer_sequence<T, I...> provides ::value_type (for T),
but nothing for itself.
Self-typedefs can be useful when users create chains of derived classes, then want to get the Standard base type.
This is especially relevant to integer_sequence, as variadic templates encourage recursive inheritance.
[2014-02-13 Issaquah: Close as NAD]
AJM: My own implementation used a different alias for types representing parameter packs, and specifically
did not define type. I tried it both ways, and found bugs more quickly when type was
not defined.
Proposed resolution:
This wording is relative to N3797.
Edit 21.2.2 [intseq.intseq] as indicated:
namespace std {
template<class T, T... I>
struct integer_sequence {
typedef T value_type;
typedef integer_sequence<T, I...> type;
static constexpr size_t size() noexcept { return sizeof...(I); }
};
}