* nick: > Greetings all, Sorry for the stupid question but I for whatever > reason can't get this to work and was wondering if it's me being > stupid or something else. The first step is to fix all compiler warnings: threadedtree.h: In instantiation of ‘ThreadedTree<T>::iterator ThreadedTree<T>::insert(const T&) [with T = int]’: main.cc:6:16: required from here threadedtree.h:282:17: warning: operation on ‘tmp->ThreadedTree<int>::Node::rightThread’ may be undefined [-Wsequence-point] tmp->rightThread = tmp->rightThread = true; ^ Then run under valgrind: ==7877== Conditional jump or move depends on uninitialised value(s) ==7877== at 0x400D30: ThreadedTree<int>::printTree() (threadedtree.h:244) ==7877== by 0x400A2B: main (main.cc:8) ==7877== Uninitialised value was created by a heap allocation ==7877== at 0x4C29180: operator new(unsigned long) (vg_replace_malloc.c:324) ==7877== by 0x400BFA: ThreadedTree<int>::insert(int const&) (threadedtree.h:280) ==7877== by 0x400A1F: main (main.cc:7) I have no idea if this points towards the cause of the bug, but it's always worth a try.