Boost logo

Boost :

From: jorg.schaible_at_[hidden]
Date: 2000-04-12 05:22:38

Hi Xavier,

you may use

t. template alloc<float>();

but please recognize, in this list we discuss possible extension libraries for
an upcoming C++ standard using the latest language techniques, but not C++
problems itself (only if they have impact on a new submission).


---------------------------------------- Message History

From: xavier_at_[hidden] on 12/04/2000 07:21

Please respond to boost_at_[hidden]

To: boost_at_[hidden]
Subject: [boost] member templates


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

     class Foo {
       // ...
          // ...
       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

Win $1000 this Friday!
Go to:

Boost list run by bdawes at, gregod at, cpdaniel at, john at