The class template polymorphic_value is proposed for addition to the C++ Standard Library. The class template, polymorphic_value, confers value-like semantics on a free-store allocated object. A polymorphic_value<T> may hold a an object of a class publicly derived from T, and copying the polymorphic_value will copy the object of the derived type.
I will present the design and reference implementation, all of which is available here https://github.com/jbcoe/polymorphic_value
YOU MAY ALSO LIKE:
A polymorphic value-type for C++
Jonathan is a mathematical developer using modern C++ and Python. He has worked in academia and the financial and energy industries. He's been a participant in the C++ standards committee since 2014.