Apple no longer advances GCC or libstdc++ on their platform, but they do ship clang. By default, when compiling with the Apple provided clang in C++11 mode, the default standard library is still libstdc++, which is too old to function reasonably in C++11 mode.

I'd like to test the __GLIBCXX__ value at configure time and reject attempts to build in C++11 mode against a "too old" libstdc++, like the one that Apple ships. So I'd need to pick a reasonable minimum version.

While GCC does a great job of enumerating language feature support in different releases of the compiler with this table, I can't find an analogous table that shows the library features as supported by each libstdc++ release. This makes it hard to choose a reasonable minimum, especially if my project depends on particular library features when compiled in C++11 mode.

What is the earliest release of libstdc++ that offers some meaningful level of support for C++11 library features? I realize this is a subjective question - I'm looking more for guidance from those who have decided this issue in their own projects. As bounds, libstdc++ 4.2 is obviously "out" and 4.8 is pretty clearly "in". Where would you draw the line if you were deciding this for your project, and why?

有帮助吗?

解决方案

I wouldn't bother with 4.4 or 4.5, they implement C++0x drafts that differ from the final standard in some important ways. 4.6 has pretty good support with all the important parts (move semantics, <type_traits>, shared_ptr, unique_ptr, <thread>, <mutex>, <tuple>, unordered containers, bind, function, ...) and 4.7 is probably 90% complete.

You should be able to tell from http://gcc.gnu.org/onlinedocs/gcc-4.6.4/libstdc++/manual/status.html and http://gcc.gnu.org/onlinedocs/gcc-4.7.3/libstdc++/manual/status.html but the links are broken for some reason.

The support in 4.7 is currently very close to that in 4.8, shown at http://gcc.gnu.org/onlinedocs/gcc-4.8.1/libstdc++/manual/manual/status.html#status.iso.2011

其他提示

to be picky gcc is not libstdc++ meaning that one is a compiler and the other one is a standard library, but since they are usually distributed in the same package, you can refer to this page and see what you need and in what version of GCC that given feature is available.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top