Archive 17/01/2023.

Stack allocated containers

sabotage3d

I came across this articles yesterday about stack allocated containers: tuxedolabs.blogspot.co.uk/2015/0 … iners.html
I wonder if Urho3d containers have something similar.
Is it safe to be used with existing Urho3d containers ?

GoogleBot42

[quote=“sabotage3d”]I came across this articles yesterday about stack allocated containers: http://tuxedolabs.blogspot.co.uk/2015/02/stack-allocated-containers.html
I wonder if Urho3d containers have something similar.
Is it safe to be used with existing Urho3d containers ?[/quote]

There is no reason why it shouldn’t be as long as you are still using pointers to urho3d objects that urho3d needs to keep track of. But for anything that the urho3d won’t need to keep track of such as temporary objects can be allocated on the stack. It should work just fine but you will run into problems that the blog post shows when you try to pass such values. :wink:

sabotage3d

I also found this as a more complete production code: code.google.com/p/chrome-browse … ontainer.h
And it can be used in conjunction with STL containers. Let me know your thoughts if there is something better out there.