I have a vector that I am loading with a know amount of elements (N).
The processing dynamically creates new elements, which are appended to the vector.
I am expecting about 2 * N additional elements to be created, so I resize the vector to 3 * N.
If the additional elements exceed that, I would like a program abort, rather than a dynamic expansion of the vector.
Is there a way to detect that, that is portable between AIX/TRU64/Linux?
Detect what? Whether the vector will be resized? Whether it has been?
The only real way to achieve this is to provide checking functionality either in a custom allocator or a function that adds elements to the vector.
e.g