#include #include class IntSLLNode { private: int index; boost::shared_ptr next; IntSLLNode(int ix){ index = ix; } public: int hasNext(){return next != 0;} boost::shared_ptr& moveNext(){return next;} int getIndex(){return index;} friend class IntSLList; }; class IntSLList { private: boost::shared_ptr head, tail; public: ~IntSLList(){/* do nothing */}; void addNode(int index){ boost::shared_ptr n(new IntSLLNode(index)); if(head == 0){ head = tail =n; } else { tail->next = n; tail = n; } } boost::shared_ptr& getHeadNode(){return head;} }; int main(){ IntSLList list; // the number to reproduce crush may vary, but seems to be stable // On my Core2Duo box, it is around 65000 // Here I dare to use a value large enough for(int i=0; i<1000000; i++){ list.addNode(i); } // crush at destruction std::cout << "CRUSH?" << std::endl; }