Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-01-06 12:11:24


"Robert Ramey" <ramey_at_[hidden]> wrote in
>
> >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);
> }
>
This was just to make more clear it doesn't involve any copying.

/Pavel


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