Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 692
Andrew Parker Avatar asked Nov 20 '13 08:11

Andrew Parker


People also ask

Does GCC 11 support C++ 20?

Now that GCC 10 is out the door, the C++ coroutines functionality is being enabled by default when running in C++20 mode (std=c++20). Thus for next year's GCC 11 release will be working coroutines functionality when C++20 is enabled.

Does GCC support C ++ 11?

Master C and Embedded C Programming- Learn as you go C++98 − GCC has full support for the 1998 C++ standard as modified in 2003 and renamed to C++03 and some later defect reports. C++11 − GCC 4.8. 1 was the first complete implementation of the 2011 C++ standard, previously known as C++0x.

Is G ++ and GCC the same?

DIFFERENCE BETWEEN g++ & gccg++ is used to compile C++ program. gcc is used to compile C program.

Does GCC 7.5 support C ++ 17?

GCC has had complete support for C++17 language features since version 8.


2 Answers

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, e.g., in the <type_traits> and the headers from the language support library (e.g., <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, e.g. std::shared_ptr<T> or the std::thread group of classes, you may get suitable replacement implementations from Boost.

like image 175
Dietmar Kühl Avatar answered Oct 13 '22 09:10

Dietmar Kühl


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.

like image 43
thor Avatar answered Oct 13 '22 09:10

thor