Topic: Calling static template members of template params


Author: Evan Kirshenbaum <evan@garrett.hpl.hp.com>
Date: 1998/06/05
Raw View
I'm having trouble trying to call a static template member of a
template parameter, roughly

    template <class T>
    class A
    {
    public:
      void f()
   {
     (T::g<int>());
   }
    };

For context, I want to be able to do something like

    class B
    {
    public:
      template <class X>
 static void g();
    };

    void
    foo(A<B> &a)
    {
      a.f();
    }


I think I understand why my compiler (HP aCC 1.12) is unable to figure
out to do with this code, but even after rereading section 14 of the
standard, I can't figure out what I'm supposed to do to tell it that
T::g is a template.  I've tried putting "template" everywhere I can
think of; I've tried surrounding the expression in parenthesis; I've
tried typing "xyzzy".  No luck.

Any guidance will be *greatly* appreciated.

--
Evan Kirshenbaum                       +------------------------------------
    HP Laboratories                    |You gotta know when to code,
    1501 Page Mill Road, Building 1U   |  Know when to log out,
    Palo Alto, CA  94304               |Know when to single step,
                                       |  Know when you're through.
    kirshenbaum@hpl.hp.com             |You don't write your program
    (650)857-7572                      |  When you're sittin' at the term'nal.
                                       |There'll be time enough for writin'
                                       |  When you're in the queue.

    http://www.hpl.hp.com/personal/Evan_Kirshenbaum/
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]