Hi Boost list!

After watching Sean Parent's lightning-talk "Inheritance is the base class of Evil" ( http://channel9.msdn.com/Events/GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil ), I decided to try a similar example with Boost's Type Erasure library, but did not succeed.

I created a vector of any<.., ostreamable<>,...>, implemented the stream operator to print this vector type and I can print its' elements. A problem arises, however, when I insert this vector as an element of a second vector. When I print the second vector I encounter an infinite loop ending with a stack overflow when accessing the vector type when it is an element of second vector.

The example which demonstrates this behaviour follows attached on this message. I am using Boost 1.55 from the trunk with clang 3.2 from Apple, compiling it with the flags "-std=c++11 -stdlib=libc++" and linking with "-stdlib=libc++". I would be grateful if anyone could try this on your local boost version and compiler.

Can anyone shed some light on why this happens? 

Regards,
--
Alexandre Pretyman