Intrusive stack container example
#include <iostream>
{
int value;
explicit MyStackNode(int v) : value(v) {}
};
int main(int argc, char** argv)
{
MyStackNode item1(123);
MyStackNode item2(456);
MyStackNode item3(789);
while (stack)
std::cout <<
"stack.pop() = " << stack.
pop()->value << std::endl;
return 0;
}
Intrusive stack container.
void push(T &item) noexcept
Push a new item into the top of the stack.
T * pop() noexcept
Pop the item from the top of the stack.
Intrusive stack container definition.