template template argument from specialized instance

G

gao_bolin

I have the following situation:

template < typename T >
class A
{
};

template < template <typename> class C >
void foo(const C &c) {}


template < typename T >
void bar() {}

My problem is, is there a way to call foo from bar, supposing that a
class from
type A is passed? If there was a way to have templated typedefs, that
would be easy by adding such a definition inside class A, but
unfortunately I cannot do it.

Basically I want to do that to avoid typing explicitely type 'A' when
calling 'foo', because type A could be actually much longer than a
single letter, and second, because there is conceptually no reason an
automatic argument deduction could not take place here. (i.e. I would
type bar(a) instead of foo<A>(a) when a is, say, a A<int>).

Thanks

B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top