Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
651 views
in Technique[技术] by (71.8m points)

c++11 - How can I use C++ 11 features in Clang?

How can I use the latest C++ 11 features in Clang? What (sub)set of features is supported?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You will need clang 3.3 to use the most relevant feature set from C++ 11. Read C++ Support in Clang for the complete list of up-to-date supported features. Clang 3.3 is claimed to be C++11 feature complete.

Clang's command line is gcc-compatible so you have to enable C++11 support via the followinf command-line switch

-std=c++11

There is also a bunch of post-C++11 features (like decltype(auto), member initializers and aggregates) that are supported by Clang 3.3. Use this command line switch to enable them

-std=c++1y

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...