Boost is essentially a c++03 library (which stimulated the c++11 standard). I'm contemplating of using some boost libraries (those that are not implemented in c++11). If I'm using c++11, does boost compile (there may be issues with non-copyable but movable objects)? and how well is boost making use of the c++11 features (variadic templates are an obvious thing to use [by some boost libraries] instead of much of the boost MPL)? (I couldn't find this amongst the boost FAQ).
-
6My biggest gripes are lack of move semantics in boost::optional and boost::variant. Several other parts of boost do have move semantics, however. – R. Martinho Fernandes Nov 28 '12 at 15:21
-
The boost::serialization library wasn't aware of `std::shared_ptr` last time I looked at it. – Flexo Nov 28 '12 at 15:22
-
I just want to point out that move semantics were *just* added to Boost.Variant this afternoon (no, I didn't do it). Hopefully they will be in the 1.53 release in February. – Marshall Clow Nov 28 '12 at 20:57
-
@flexo. Please be free to create a feature request if it doesn't already exists. – Vicente Botet Escriba Dec 15 '12 at 16:17
2 Answers
Boost is moving towards using C++11 features.
But one thing to remember is that boost is not "a library", but rather a collection of libraries. Some of them (for example boost::array
) probably won't ever be updated to use many c++11 features. Why should it, when you have std::array
in the standard (which was based on boost::array
?)
On the other hand, Boost would like to remain useful for people who are still using C++03.
Note: Even though I write as if "Boost" is some monolithic entity, there are lots of people who contribute to boost and they have many different opinions. ;-)
To see how well various boost libraries work with C++11 compilers, you can check out the Boost Testing web page.

- 15,972
- 2
- 29
- 45
-
+1 for the link to Boost Testing! Yes I know boost are many libraries. One (ie Boost) can use the value of macro __cplusplus to enable/exploit some c++11 features but otherwise remain c++03. Also, some boost developers may be interested in developing for c++11. That would require any boost internal dependencies to work well under c++11. – Walter Nov 28 '12 at 17:29
-
If boost::array doesn't implements C++11 semantic, the user writing portable code (in particular Boost libraries) should use conditional compilation, which is not desirable. – Vicente Botet Escriba Dec 15 '12 at 16:20
-
@VicenteBotetEscriba I don't see a problem here. You just define a typedef to either std::array (if __cplusplus >= 201103L) or boost::array. what's undesirable here? – Walter Dec 15 '12 at 20:28
C++11 was made do be as backwards compatible as possible. Unless boost is using reserved keywords that are new to C++11, there is no reason I know of why it shouldn't compile just fine with the new standard.

- 1,575
- 14
- 24
-
There are some corner cases where backwards compatibility is broken (I do recall there being a problem with the default move constructor of some class, but I can't quite recall). – Cubic Nov 28 '12 at 17:23
-
@Cubic: I wasn't aware of that. Thanks for mentioning it. I'll have to keep my eyes open for other fringe cases. – eestrada Nov 28 '12 at 17:59