Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-01-13 02:06:38


"Aleksey Gurtovoy" <agurtovoy_at_[hidden]> wrote
> Arkadiy Vertleyb writes:
[...]
> > As for your question however, the conceptual problem with template
> > template parameters is that they can't be returned from
> > meta-functions:
> >
> > template<template<class> class T> class X
> > {
> > // I know T here, but how do I pass it outside???
>
> typedef T<_> type;
> or
> typedef mpl::quote1<T> type;
>
> > };
> >
> > Of course, they can be wrapped... I am wondering whether it would be
> > possible to use this....
>
> Depends on what you want to do with the result. One thing you can do
> for sure is to instantiate it with particular arguments.

Template template metaprogramming :)

Actually I want to use it as a template parameter. This is about typeof.
The type was somehow encoded into mpl::vector of integeres. Now I want to
decode it (pseudocode):

// template<class T, int n, template<class> class Tpl> struct MyTemplate;

typedef MyTemplate<
    typename decode_type<iter1>::type, // type template parameter
    decode_integral<iter2>::value, // integral template parameter
    decode_template<iter3>::??? // template template parameter
> type;

Doesn't really seem wrapping in quote1 or instantiation with _ is going to
help...

This is kind of funny. Almost starts looking as the original problem with
typeof, where the type is known inside the function, but can't be passed
outside... Where is "sizeof" that is going to help? :)

Regards,

Arkadiy


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