Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-01-06 11:43:48


Pavel Vozenilek wrote:

>The factory may allocate new object inside and it may not be possible to
create default constructed object.

>If something like this is possible:

> template<class Archive>
> void load(Archive & ar, color** uninitialized_ptr_to_c){
> int id;
> ar >> id
> c* newly_created_c = color_from_id(id);
> (*uninitialized_ptr_to_c) = newly_created_c;
>}

That loooks OK to me though I'm not sure why you
wouldn't just use this:
 template<class Archive>
 void load(Archive & ar, color** uninitialized_ptr_to_c){

   int id;
   ar >> id;
   *uninitialized_ptr_to_c = color_from_id(id);
}

Robert Ramey


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