|
Boost Users : |
Subject: [Boost-users] Type Erasure: Infinite loop when accessing an element of a container of any<>, where the element is another container
From: Alexandre Pretyman (alexandre.pretyman_at_[hidden])
Date: 2013-10-08 14:51:02
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net