简体   繁体   中英

Open source STL implementations with C++11 support

In short, I'm looking for alternatives to STLPort. STLPort hasn't had an update for some time (since 2008?) and is lacking C++11 support. Does anyone know of any alternatives? I need to compile using various toolchains, for various architectures and various target OSes.

I'm going to start looking into the GNU C++ implementation and see how tied in it is to the GCC toolchain as an alternative and will post back with results. But if anyone has any up front knowledge here that'd be great.

Alternatives to this would be implementations of various key C++11 STL features like new smart pointer types and std::threads. Worst case I can probably extract smart pointers from boost. Are there any implementations of std::threads in terms of say pthreads or Windows threads?

Thanks

You can have a look at libc++ . It is the standard C++ library for clang . I haven't tried to compile it with a different compiler or on a different Platform than MacOS. While there are certainly compiler dependencies, eg, in the <type_traits> and the headers from the language support library (eg, <exception> , <type_info> , etc), I can imagine that most of the code would compile with other compilers.

You already mentioned libstdc++ which seems to work OK with other compilers than gcc , at least on Linux and MacOS: clang used to use libstdc++ on MacOS. However, I don't now how happy libstdc++ is to be compiled with other compilers.

For specific classes, eg std::shared_ptr<T> or the std::thread group of classes, you may get suitable replacement implementations from Boost .

Other than the implementations shipped with gcc and clang, there is also a third-party open-source uSTL (with c++11 support). According to its website, it's aimed at reducing some of the overhead in "template bloat". However, it does not implement wchar strings. They also have non-standard memory allocation.

There are examples in their website showing how it can be used instead of gcc's stl.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM