Yes you are right, I can see if your making several function calls with this singleton within a single function it would be best to store the pointer at the top of the function and call however many times. Plus saving the overhead if the call is something like this
Code:
ManagedObject* mobj = SomeSingletonObjct::Instance()->GetManagedObject("name");
where GetManagedObject() may have to do a search, writing
Code:
mobj->DoSomething();
and searching once is much better than writing this
Code:
SomeSingletonObjct::Instance()->GetManagedObject("name")->DoSomething();
and searching eight times. What I originally was looking to do was to quckly shorten something like this
Code:
SomeSingletonObjct::Instance()->GetManagedObject("name")->DoSomething();
to
gSomeSing->GetManagedObject("name")->DoSomething();
or
gSomeSing->DoSomething();
when its being used in a place where it only needs to be called once and storing the pointer has no purpose because its used once either way. Thx for the replies.