Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any plans for a Standard type-erasing container?

Tags:

c++

boost

c++14

The process of integrating boost functionality into the standard library has become apparent over the years.

It seems though, that a useful & practical part of boost, that is containers that provide type erasure, has escaped this process.

  1. Are there any particular reasons (performance penalty, lack of robustness) for this ?

  2. Are there any proposals related to incorporating such functionality (eg boost::any) in the next Standard Library ?

  3. shared_pointer uses type erasure, are there any other facilities in today's Standard Library where we can take advantage of this technique ?

like image 965
Nikos Athanasiou Avatar asked Jan 30 '26 03:01

Nikos Athanasiou


1 Answers

  1. Type erasure usually introduces an additional indirection and eventually virtual function calls which degrade performance.

  2. There is a just recently updated working draft "C++ Extensions for Library Fundamentals" which proposes (among other features) boost::any for the standard.

  3. std::function would be another example.

like image 115
proto Avatar answered Feb 01 '26 19:02

proto