https://linen.dev logo
How to check if the object held by autoPtr has bee...
# programming
t
How to check if the object held by autoPtr has been allocated? I have set the autoPtr like this:
Copy code
autoPtr<edgeMesh> initEdges(nullptr);
...
if (init_edges)
{
    initEdges.reset(new edgeMesh(initEdgesFileName));
}
...
func(initEdges);
So the question is, how can I check inside function
func
that is
initEdges
allocated or not before I try to use it? If I simply try to use it I get error
Copy code
--> FOAM FATAL ERROR: 
object of type N4Foam8edgeMeshE is not allocated