>
> #include <iostream>
>
>
> using namespace std;
>
>
> namespace infinite
> {
>
>
> template <typename T = void, typename U = void>
>  struct typelist : U
>  {
>   typedef T type;
>
>   T value;
>
>   typelist(T const & a, U const & b) : value(a), U(b) {}
>  };
>
> template <>
>  struct typelist<void, void>
>  {
>   typedef void type;
>  };
>
> template <typename T>
>  struct typelist<T, void>
>  {
>   typedef T type;
>
>   T value;
>
>   typelist(T const & a) : value(a) {}
>  };
>
>
> typelist<> const begin = typelist<>();
>
>
> }
>
>
> template <typename V>
>  infinite::typelist<V, void> operator , (infinite::typelist<> const &, V
> const & v)
>  {
>   return infinite::typelist<V, void>(v);
>  }
>
> template <typename T, typename U, typename V>
>  infinite::typelist< V, infinite::typelist<T, U> > operator ,
> (infinite::typelist<T, U> const & t, V const & v)
>  {
>   return infinite::typelist< V, infinite::typelist<T, U> >(v,
> infinite::typelist<T, U>(t));
>  }
>
>
> // Usage example:
>
> template <typename T, typename U>
>  void foo(infinite::typelist<T, U> const & i)
>  {
>   cout << __PRETTY_FUNCTION__ << endl;
>  }
>
> int main()
> {
>  foo((infinite::begin, true, (char *) "adasd", 12367, 127.2));
> }
I have not compiled it, but looks ok.
Anyway, why the two (( and )) ?

I think it's not needed.

Anyway, I'm not sure how much this generality can buy you.
I do like it, though :)

By the way, Andrei Alexandrescu had an article (about 4-5 years ago) about
inline containers. Look it up.

Best,
John

>
>
>
> My 0,02$
>
> Philippe
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to