for example boost::function
is moved almost entirely to std::function
, the same is with boost::shared_ptr
But I can't find std::any
?
Was it renamed or was not it placed in new standard at all by any reason?
for example boost::function
is moved almost entirely to std::function
, the same is with boost::shared_ptr
But I can't find std::any
?
Was it renamed or was not it placed in new standard at all by any reason?
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
Since the question was asked, we advanced towards std::experimental::any as an optional feature voted out of C++14 standard.
It was then implemented in GCC 5.1, at least.
The feature was since then standardized in C++17 resulting in std::any. See also C++17's std::variant for a type-safe union which either holds one of a limited known-types alternative, or is empty (thanks remy-lebeau for the tip).
std::variant
(similar to boost::variant
) has also been standardized and will appear in C++17. –
Leta 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
Std::any was recently accepted into the c++17 standard:
I think the default position was that a library would NOT be included in the new standard unless it was submitted to be included and then passed the committee.
I am not sure if boost::any was ever submitted. Probably not. However you can still use boost::any.
My guess is that with C++11 boost libraries will be rewritten, some will be considered redundant and others will be changed to use move semantics, initializer lists and auto thus being written in C++11 style with C++11 features.
Most likely new libraries will all be in C++11 but existing boost packages will be kept as available for some time to come as many will not have switched to C++11 compilers yet. I would also guess that only features of C++11 that are implemented by all the main compilers will go into the package at first.
This is probably more a question for programmers than stackoverflow, and even better for comp.std.c++.moderated and boost mailing lists.
© 2022 - 2024 — McMap. All rights reserved.