Interrupts are not mentioned in the C++ standard (although signals are), so the standard cannot tell you which operations are safe in interrupt context. The situation is in essence the same as for thread-safety -- you need to consult your implementation for what additional guarantees it offers relating to the new concepts it introduces.
In practice, I expect that the operations on vector which are guaranteed to leave iterators valid will not allocate or free any memory (assuming of course that assigning values to the members of the vector does not itself allocate memory in a copy constructor or operator=
). They certainly won't re-allocate the vector's internal storage buffer: the standard guarantees this in terms of when "reallocation" is or is not permitted to occur. There's nothing else you'd expect vector to need allocated memory for. If you ensure ahead of time that the vector has sufficient capacity, then once you're in interrupt context you can push_back
elements, or assign to them, and guarantee that the vector will not reallocate its contiguous storage, and therefore have strong reason to believe it won't allocate any more memory.
What it might do, though, is cause assigned virtual address space to be committed that was not previously committed. I don't know whether or not that's safe in interrupt context. Ensuring ahead of time that the vector has sufficient size, not just capacity, should mean (with a suitable constructor of course) that all the memory is written to and hence committed.
list is different: it has no excess capacity, and can allocate and free list nodes as items are added and removed. I'd expect an intrusive list to be usable in interrupt context, though, or you could create a list of "zero objects" and then assign to the elements, in the same way you can with vector.
Still, that's just based on expected/typical implementations. The standard doesn't prevent vector from allocating and freeing a few blocks just for laughs, or for obscure platform-related reasons.