Boost logo

Boost :

From: xavier (xavier_at_[hidden])
Date: 2000-04-12 02:21:42


Hello,

I'm experiencing trouble with member templates, I've got something like
this :

        class Foo {
          // ...
        public:
          // ...
          int size();
          // ...
          template <class T> T* alloc() { return new T [size()]; }
        };

And I use it like this :

        void f()
        {
          Foo f;
          // ...
          float* pf = f.alloc<float>();
        }
        
My compiler (egcs/g++ 2.9.x) claims that there is an error near '<' or '>'
(I can't remember :)). Any idea?

I heard that member templates are not ANSI compliant but supported by most
compilers and they are really useful...

 - Xavier


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