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).

Greetings,
Jörg

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

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

Please respond to boost_at_[hidden]

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


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

------------------------------------------------------------------------
Win $1000 this Friday!
Go to:
http://click.egroups.com/1/2892/2/_/9351/_/955524211/
------------------------------------------------------------------------


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