使用C ++ 11< regex>与大约2013年编译器 [英] Options for using C++11 <regex> with a circa 2013 compiler
问题描述
对于C ++ 11正则表达式,是否有完整/正确的实现(现在)?
有关编译器支持与库支持的注意事项:
编译器支持 =编译器识别添加到相关功能的语言的任何新语法。使用新功能添加到您的程序的代码将编译。
库支持 =库已更新以实际实施此功能。
*编辑:我已更新此摘要并附上新信息,并将其移至下面的答案。
每个堆栈交换策略关于它是否可以回答自己的问题我更新
问题的摘要部分
regex $ c $ c> until GCC 4.9.0
Clang:编译regex
标准库:
- 正则表达式只支持 libstdc ++ ,因为GCC 4.9.0 lib)
- libc ++ (LLVM的标准库)支持regex在 Mac OS 上验证
- libc ++ 可以从其他平台的源代码构建。
$ b MSVC:正则表达式自 MSVC 2010 起生效(根据@Laurent和关联的投票的每个回答)
strong> Boost:
C ++ 11正则表达式是基于或建模后Boost。
我认为这意味着不完全一样。
如果有确定的差异列表,请使用链接进行注释。
Is there any full/correct implementation available (right now) for C++11 regex?
Note on Compiler support vs. Library support:
Compiler Support = compiler recognizes any new syntax added to the language for the feature in question. Code utilizing the new feature added to your program will compile.
Library Support = library updated to actually implement the feature. Code added to your program and linked to the library will work.
*Edit: I've updated this summary with new information and moved it into an answer below.
解决方案 Per stack exchange policy about it being ok to answer your own question I am updating
the summary part of the question with new info and moving it into this answer.
GCC: Does not provide a working regex
until GCC 4.9.0
Clang: Compiles regex
Standard Library:
- regex only supported by libstdc++ since GCC 4.9.0 (GNU's standard lib)
- regex is supported by libc++ (LLVM's standard lib)
- libc++ fully verified on Mac OS
- libc++ can be built from source for other platforms.
- (I built and verified some of regex on Linux)
MSVC: Regex works since MSVC 2010 (Per answer from @Laurent and associated up votes)
Boost:
C++11 regex is "based on" or "modeled after" Boost.
I take that to mean not exactly the same.
If there is a definitive list of differences please comment with a link.
这篇关于使用C ++ 11< regex>与大约2013年编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!