Does C++11 standard provide something like boost::any?

前端 未结 4 1268
囚心锁ツ
囚心锁ツ 2021-01-03 23:39

for example boost::function is moved almost entirely to std::function, the same is with boost::shared_ptr

But I can\'t find

4条回答
  •  悲&欢浪女
    2021-01-04 00:17

    Not every library from boost makes it into the standard (and even those that do may have components removed). Generally the commitee is pretty conservative when it comes to adding to the standardlibrary (since it's next to impossible to get something removed at a later point if the inclusion was a mistake (.e.g. because there is a better alternative)).

    boost::function and boost::shared_ptr where pretty much a given for inclusion since they where already part of tr1. boost::any on the other hand did not make the cut. It might however be included in the standard library at a later point (e.g. in the next technical report, look here). While boost::any is nice to have, I wouldn't rate it as quite as important as e.g. shared_ptr.

    Concluding: boost::any is not part of C++11, since the committee didn't see any pressing need to include it

提交回复
热议问题