On Oct 14, 11:38 pm, red floyd <no.spam.h...@example.com> wrote:
Kai-Uwe Bux wrote:
The best guarantees makes std::list, which is one of the
foremost reasons to use it.
We had a contract where the coding spec said flat-out "NO use
of new whatsoever". So we used std::list instead, and
returned pointers to the list elements when needed instead.
Which is fine unless you need polymorphic objects.
What was the motivation for this restriction? If it was because
the program was a critical component, and couldn't fail, then
you can't use any dynamic allocation, even if it's hidden in the
library (since almost by definition, dynamic allocation can
fail---and yes, I know that there are ways of supporting some
limited dynamic allocation without failure).
avoid memory leaks. The list is in effect managing the lifetime of the
objects.
As long as it does it right...