Boost logo

Boost :

Subject: Re: [boost] compile time parser generator
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-01-09 13:51:31


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk