Message: Re: Using shared_ptr (from the boost library) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Using shared_ptr (from the boost library) 

Forum: Installation and Configuration
Re: None Using shared_ptr (from the boost library)
Re: Question Re: Using shared_ptr (from the boost library) (Gabriele Cosmo)
Re: None Re: Using shared_ptr (from the boost library) (Peter Niessen )
Date: 21 Nov, 2007
From: Gabriele Cosmo <Gabriele Cosmo>

Hi Peter,

> In my application, I usually do a lot of "new", espescially in the
> detector construction: New Elements, new Material Properties, new
> volumes, etc.
>
> Then, before returning the physical world volume, I lose all these
> pointers, as they go out of scope:

materials and geometrical volumes/solids are 'cached' and registered in stores internally
in Geant4. These pointers are de-registered and deleted at the end of the application
if not explicitly done by the user. If an exception occurs, no tiding up is done implicitly
by the Geant4 kernel...

btw, you certainly don't want to delete the pointers within the construct() method... you
may want to keep the pointers as members of the class, or implement a way to cache
them if wish to reuse them elsewhere within the lifetime of your DetectorConstruction
object.

Gabriele

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Using shared_ptr (from the boost library)   (Peter Niessen - 21 Nov, 2007)
 Add Message Add Message
to: "Re: Using shared_ptr (from the boost library)"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]