简体   繁体   English

支持C ++ 11的开源STL实现

[英]Open source STL implementations with C++11 support

In short, I'm looking for alternatives to STLPort. 简而言之,我正在寻找STLPort的替代品。 STLPort hasn't had an update for some time (since 2008?) and is lacking C++11 support. STLPort有一段时间没有更新(自2008年以来?),并且缺乏C ++ 11支持。 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. 我将开始研究GNU C ++实现,看看它与GCC工具链的关系如何作为替代,并将回发结果。 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. 替代方案是实现各种关键的C ++ 11 STL功能,如新的智能指针类型和std :: threads。 Worst case I can probably extract smart pointers from boost. 最糟糕的情况我可以从boost中提取智能指针。 Are there any implementations of std::threads in terms of say pthreads or Windows threads? 就pthreads或Windows线程而言,是否存在std :: threads的任何实现?

Thanks 谢谢

You can have a look at libc++ . 你可以看一下libc ++ It is the standard C++ library for clang . 它是clang的标准C ++库。 I haven't tried to compile it with a different compiler or on a different Platform than MacOS. 我没有尝试使用不同的编译器或在与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. 虽然肯定存在编译器依赖性,例如,在<type_traits>和语言支持库的头文件中(例如, <exception><type_info>等),但我可以想象大多数代码将与其他编译器一起编译。

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. 您已经提到过libstdc ++ ,它似乎可以与其他编译器一起使用,而不是gcc ,至少在Linux和MacOS上: clang曾经在MacOS上使用libstdc ++。 However, I don't now how happy libstdc++ is to be compiled with other compilers. 但是,我现在不高兴libstdc ++与其他编译器一起编译。

For specific classes, eg std::shared_ptr<T> or the std::thread group of classes, you may get suitable replacement implementations from Boost . 对于特定的类,例如std::shared_ptr<T>或类的std::thread组,您可以从Boost获得合适的替换实现。

Other than the implementations shipped with gcc and clang, there is also a third-party open-source uSTL (with c++11 support). 除了gcc和clang附带的实现之外,还有第三方开源uSTL (支持c++11 )。 According to its website, it's aimed at reducing some of the overhead in "template bloat". 根据其网站,它旨在减少“模板膨胀”的一些开销。 However, it does not implement wchar strings. 但是,它不实现wchar字符串。 They also have non-standard memory allocation. 它们还具有非标准内存分配。

There are examples in their website showing how it can be used instead of gcc's stl. 他们的网站上有一些例子说明如何使用它代替gcc的stl。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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