|
Boost : |
From: Vesa Karvonen (vesa.karvonen_at_[hidden])
Date: 2001-12-17 09:58:34
Take a look at:
http://www.boost.org/libs/preprocessor/doc/tutorial.htm#ENUM_PARAMS
From: "Peter Dimov" <pdimov_at_[hidden]>
> struct nil;
> struct missing;
> template<class, class> struct pair;
>
> template<class A1 = missing, class A2 = missing, class A3 = missing, class
> A4 = missing> struct list
> {
> typedef typename list<A2, A3, A4, missing>::type rest;
> typedef pair<A1, rest> type;
> };
>
> template<> struct list<missing, missing, missing, missing>
> {
> typedef nil type;
> };
>
> The number of arguments can be increased arbitrarily, although IMO both 50
> and 128 are overkill.
>
> I believe that this implementation compares well with the existing solutions
> offered by Loki and MPL.
>
> --
> Peter Dimov
> Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk