
9 Jan
2012
9 Jan
'12
6:51 p.m.
From: Fernando Pelliccioni
A little code improvement
template <typename ArrayType, size_t N> constexpr ArrayType nth( const ArrayType (&s)[N], int n ) { return n >= N ? 0 : s[n]; }
Hmmm, now that I think of it: int S[] = {1, 1, 2, 3, 5, 8}; some_template<nth<size_of(S)>(S, 3)> is pretty nice to have in TMP too. Thanks, Luke