ENH: cleanup autoPtr class (issue #639)
Improve alignment of its behaviour with std::unique_ptr - element_type typedef - release() method - identical to ptr() method - get() method to get the pointer without checking and without releasing it. - operator*() for dereferencing Method name changes - renamed rawPtr() to get() - renamed rawRef() to ref(), removed unused const version. Removed methods/operators - assignment from a raw pointer was deleted (was rarely used). Can be convenient, but uncontrolled and potentially unsafe. Do allow assignment from a literal nullptr though, since this can never leak (and also corresponds to the unique_ptr API). Additional methods - clone() method: forwards to the clone() method of the underlying data object with argument forwarding. - reset(autoPtr&&) as an alternative to operator=(autoPtr&&) STYLE: avoid implicit conversion from autoPtr to object type in many places - existing implementation has the following: operator const T&() const { return operator*(); } which means that the following code works: autoPtr<mapPolyMesh> map = ...; updateMesh(*map); // OK: explicit dereferencing updateMesh(map()); // OK: explicit dereferencing updateMesh(map); // OK: implicit dereferencing for clarity it may preferable to avoid the implicit dereferencing - prefer operator* to operator() when deferenced a return value so it is clearer that a pointer is involve and not a function call etc Eg, return *meshPtr_; vs. return meshPtr_();
Showing
- applications/solvers/combustion/PDRFoam/createFields.H 2 additions, 2 deletionsapplications/solvers/combustion/PDRFoam/createFields.H
- applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H 4 additions, 4 deletions...leInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H
- applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C 1 addition, 1 deletion...InterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C
- applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H 2 additions, 2 deletions...InterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H
- applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H 2 additions, 2 deletions...ractingMixture/incompressibleTwoPhaseInteractingMixture.H
- applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H 3 additions, 3 deletions...ssibleThreePhaseMixture/incompressibleThreePhaseMixture.H
- applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C 1 addition, 1 deletion...tiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C
- applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H 2 additions, 2 deletions...tiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H
- applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C 1 addition, 1 deletion...phase/multiphaseInterFoam/multiphaseMixture/phase/phase.C
- applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H 1 addition, 1 deletion...phase/multiphaseInterFoam/multiphaseMixture/phase/phase.H
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C 11 additions, 38 deletions...dMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C 4 additions, 8 deletions...Systems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C 10 additions, 24 deletions...ePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C 26 additions, 75 deletions...MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C 12 additions, 36 deletions...malPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C 1 addition, 1 deletion...aseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C 1 addition, 1 deletion...EulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C
- applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C 5 additions, 5 deletions...EulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C
- applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H 2 additions, 7 deletions...e/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H
- applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H 1 addition, 1 deletion...m/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H
Please register or sign in to comment