template template argument from specialized instance

Discussion in 'C++' started by gao_bolin@voila.fr, Mar 29, 2005.

  1. Guest

    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.
     
    , Mar 29, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Allan Schwartz
    Replies:
    1
    Views:
    419
    Victor Bazarov
    Aug 9, 2004
  2. BigMan
    Replies:
    3
    Views:
    1,466
    BigMan
    Apr 22, 2005
  3. Replies:
    1
    Views:
    377
    Victor Bazarov
    Feb 17, 2006
  4. nw
    Replies:
    0
    Views:
    338
  5. Olive
    Replies:
    4
    Views:
    256
    Olive
    Jul 6, 2012
Loading...

Share This Page