Re: Performer and the STL

New Message Reply Date view Thread view Subject view Author view

From: Xavier Decoret (Xavier.Decoret++at++imag.fr)
Date: 01/18/2000 08:09:35


Christian Skluzacek wrote:
> Xavier,
>
> Here's what I developed. I basically got the starting point from Musser
> & Saini's STL Tutorial and Reference Guide for writing my own Allocator classes.
>

Thanks Christian,

You can probably answer to a few quesion I was wondering about STL:

If I want to have a vector<myObj> in my shared data structure like:
struct SharedData
{
  vector<MyObj> v;
}
I guess that:
SharedData *shared = (SharedData *) pfMalloc(sizeof(SharedData),arena);

won't work because vector new operator doesn't allocate in shared
memory.
So I probably need to do:
struct SharedData
{
  vector<MyObj> *v;
}
SharedData *shared = (SharedData *) pfMalloc(sizeof(SharedData),arena);
shared->v = (vector<MyObj> *) pfMalloc(sizeof(vector<MyObj>),arena);

I am right or is it unecessary to use this pointer "indirection".

Then I still may have problem with MyObj because this classe's operator
new does'nt
allocate in shared memory either.
As far as I understand, I just need to make MyObj derives from pfObject
whose operator new does what's necessary.

As you can see, I am not completely sure about this and if you have
already spend sometime understanding it, I would appreciate that you
help me save some hours of debugging!

Thanks.

-- 
+------------------+--------------------------------------------------------+
| Xavier DECORET   | iMAGIS, Laboratoire GRAVIR/IMAG 
(CNRS,INRIA,INPG,UJF) |
|                  | INRIA Rhone-Alpes, 655 Av de l'Europe, 38330
Montbonnot|
| Doctorant        | France. Tel: +33 4 76 61 54 58 - Fax: +33 4 76 61
54 40|
+------------------+--------+-----------------------------------------------+
| Xavier.Decoret++at++imag.fr    | 
http://www-imagis.imag.fr/~Xavier.Decoret    |
+---------------------------+-----------------------------------------------+


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Jan 18 2000 - 08:10:03 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.