I have a class Index
similar to std::integer_sequence
:
template<std::size_t... NValues>
struct Index { };
And I wanna Fill it with sequence N-1, N-2, ..., 2, 1, 0.
template<std::size_t N>
struct MakeIndex
{
private:
template<std::size_t I, std::size_t... NIndexValues>
struct _Make;
public:
using Type = typename _Make<N>::Type;
private:
template<std::size_t I, std::size_t... NIndexValues>
struct _Make
{
using Type = typename _Make<I - 1, NIndexValues..., I - 1>::Type;
};
template<std::size_t... NIndexValues>
struct _Make<0, NIndexValues...>
{
using Type = Index<NIndexValues...>;
};
};
int main()
{
using T = MakeIndex<5>::Type;
}
On clang compiler(3.7.0), it produce
fatal error: recursive template instantiation exceeded maximum depth of 256
It works very well on VS and GCC. Maybe I did something wrong? Or it is compiler bug?
Aucun commentaire:
Enregistrer un commentaire