Problem 2457 - Provide const-reference signature for G4MultiUnion::AddNode
Summary: Provide const-reference signature for G4MultiUnion::AddNode
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: 10.7
Hardware: All All
: P4 minor
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2021-12-17 19:43 CET by Ben Loer
Modified: 2022-01-14 09:53 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Ben Loer 2021-12-17 19:43:11 CET
The signature for `G4MultiUnion::AddNode` is 
```
void AddNode(G4VSolid& solid, G4Transform3D& trans);
```

This prevents compact construction via in-place declaration of the transform like
```
munion->AddNode(*solid, G4TranslateX3D(dx));
```
and instead requires declaring an extraneous transform object. In the implementation, the transform is copied into a member vector, so there is no reason not to make method argument `const`. 

Related, it would be nice to provide signature that accepts the solid as a pointer
```
void AddNode(G4VSolid* solid, const G4Transform3D& trans);
```
to be more similar to the boolean solid constructors.
Comment 1 Gabriele Cosmo 2022-01-14 09:53:57 CET
Thanks. The proposed change is now implemented in the development branch and will be available in the next public release.