typeInfo: Added dynamicCastNull and refCastNull
These functions dynamic cast a reference to a type, and return a null object reference if the cast fails. The standard dynamicCast and refCast functions, by contrast, throw an error if the cast fails.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -72,6 +72,10 @@ extern const NullObject* nullObjectPtr;
|
||||
template<class T>
|
||||
inline const T& NullObjectRef();
|
||||
|
||||
//- Return non-const reference to the nullObject of type T
|
||||
template<class T>
|
||||
inline T& NullObjectNonConstRef();
|
||||
|
||||
//- Return const pointer to the nullObject of type T
|
||||
template<class T>
|
||||
inline const T* NullObjectConstPtr();
|
||||
|
||||
Reference in New Issue
Block a user