반응형
GCC 에서 지원하는 C++11 피쳐들을 알아보자.
gcc 4.9 에서는 c++11 피쳐가 지원된다는 것은 알고 있을겁니다.
그런데, gcc 4.6에서도 c++11 이 지원된다고 아셨다면, 아래 표를 참조해서 내가 쓸수 있는 피쳐와 그렇지 못한 피쳐를 확인해야 합니다.
gcc 4.6 부터 c++11 피쳐들이 100% 지원되는 것이 아니기 때문이죠.
대표적으로 유용한 override keyword 는 4.7 부터 지원하고 있죠.
<참고 : https://gcc.gnu.org/projects/cxx-status.html#cxx11>
Language Feature | Proposal | Available in GCC? | SD-6 Feature Test |
---|---|---|---|
Rvalue references | N2118 | GCC 4.3 | __cpp_rvalue_references >= 200610 |
Rvalue references for *this | N2439 | GCC 4.8.1 | __cpp_ref_qualifiers >= 200710 |
Initialization of class objects by rvalues | N1610 | Yes | |
Non-static data member initializers | N2756 | GCC 4.7 | __cpp_nsdmi >= 200809 |
Variadic templates | N2242 | GCC 4.3 | __cpp_variadic_templates >= 200704 |
Extending variadic template template parameters | N2555 | GCC 4.4 | |
Initializer lists | N2672 | GCC 4.4 | __cpp_initializer_lists >= 200806 |
Static assertions | N1720 | GCC 4.3 | __cpp_static_assert >= 200410 |
auto -typed variables | N1984 | GCC 4.4 | |
Multi-declarator auto | N1737 | GCC 4.4 | |
Removal of auto as a storage-class specifier | N2546 | GCC 4.4 | |
New function declarator syntax | N2541 | GCC 4.4 | |
New wording for C++0x lambdas | N2927 | GCC 4.5 | __cpp_lambdas >= 200907 |
Declared type of an expression | N2343 | GCC 4.3 | __cpp_decltype >= 200707 |
decltype and call expressions | N3276 | GCC 4.8.1 | |
Right angle brackets | N1757 | GCC 4.3 | |
Default template arguments for function templates | DR226 | GCC 4.3 | |
Solving the SFINAE problem for expressions | DR339 | GCC 4.4 | |
Template aliases | N2258 | GCC 4.7 | __cpp_alias_templates >= 200704 |
Extern templates | N1987 | Yes | |
Null pointer constant | N2431 | GCC 4.6 | |
Strongly-typed enums | N2347 | GCC 4.4 | |
Forward declarations for enums | N2764 | GCC 4.6 | |
Generalized attributes | N2761 | GCC 4.8 | __cpp_attributes >= 200809; __has_cpp_attribute(noreturn) >= 200809; __has_cpp_attribute(carries_dependency) == 0 (not implemented) |
Generalized constant expressions | N2235 | GCC 4.6 | __cpp_constexpr >= 200704 |
Alignment support | N2341 | GCC 4.8 | |
Delegating constructors | N1986 | GCC 4.7 | __cpp_delegating_constructors >= 200604 |
Inheriting constructors | N2540 | GCC 4.8 | __cpp_inheriting_constructors >= 200802 |
Explicit conversion operators | N2437 | GCC 4.5 | |
New character types | N2249 | GCC 4.4 | __cpp_unicode_characters >= 200704 |
Unicode string literals | N2442 | GCC 4.5 | __cpp_unicode_literals >= 200710 |
Raw string literals | N2442 | GCC 4.5 | __cpp_raw_strings >= 200710 |
Universal character name literals | N2170 | GCC 4.5 | |
User-defined literals | N2765 | GCC 4.7 | __cpp_user_defined_literals >= 200809 |
Standard Layout Types | N2342 | GCC 4.5 | |
Defaulted and deleted functions | N2346 | GCC 4.4 | |
Extended friend declarations | N1791 | GCC 4.7 | |
Extending sizeof | N2253 | GCC 4.4 | |
Inline namespaces | N2535 | GCC 4.4 | |
Unrestricted unions | N2544 | GCC 4.6 | |
Local and unnamed types as template arguments | N2657 | GCC 4.5 | |
Range-based for | N2930 | GCC 4.6 | __cpp_range_based_for >= 200907 |
Explicit virtual overrides | N2928 N3206 N3272 | GCC 4.7 | |
Minimal support for garbage collection and reachability-based leak detection | N2670 | No | |
Allowing move constructors to throw [noexcept] | N3050 | GCC 4.6 | |
Defining move special member functions | N3053 | GCC 4.6 | |
Concurrency | |||
Sequence points | N2239 | Yes | |
Atomic operations | N2427 | GCC 4.4 | |
Strong Compare and Exchange | N2748 | GCC 4.5 | |
Bidirectional Fences | N2752 | GCC 4.8 | |
Memory model | N2429 | GCC 4.8 | |
Data-dependency ordering: atomics and memory model | N2664 | GCC 4.4 (memory_order_consume) | |
Propagating exceptions | N2179 | GCC 4.4 | |
Abandoning a process and at_quick_exit | N2440 | GCC 4.8 | |
Allow atomics use in signal handlers | N2547 | Yes | |
Thread-local storage | N2659 | GCC 4.8 | |
Dynamic initialization and destruction with concurrency | N2660 | GCC 4.3 | |
C99 Features in C++11 | |||
__func__ predefined identifier | N2340 | GCC 4.3 | |
C99 preprocessor | N1653 | GCC 4.3 | |
long long | N1811 | GCC 4.3 | |
Extended integral types | N1988 | Yes |
C++14 지원은 아래와 버전들에서 지원되고 있습니다.
Language Feature | Proposal | Available in GCC? | SD-6 Feature Test |
---|---|---|---|
Tweak to certain C++ contextual conversions | N3323 | 4.9 | |
Binary literals | N3472 | 4.3 (GNU) 4.9 (N3472) | __cpp_binary_literals >= 201304 |
Return type deduction for normal functions | N3638 | 4.8 (N3386) 4.9 (N3638) | __cpp_decltype_auto >= 201304 |
Generalized lambda capture (init-capture) | N3648 | 4.5 (partial) 4.9 (N3648) | __cpp_init_captures >= 201304 |
Generic (polymorphic) lambda expressions | N3649 | 4.9 | __cpp_generic_lambdas >= 201304 |
Variable templates | N3651 | 5 | __cpp_variable_templates >= 201304 |
Relaxing requirements on constexpr functions | N3652 | 5 | __cpp_constexpr >= 201304 |
Member initializers and aggregates | N3653 | 5 | __cpp_aggregate_nsdmi >= 201304 |
Clarifying memory allocation | N3664 | N/A | |
Sized deallocation | N3778 | 5 | __cpp_sized_deallocation >= 201309 |
[[deprecated]] attribute | N3760 | 4.9 (N3797) | __has_cpp_attribute(deprecated) >= 201309 |
Single-quotation-mark as a digit separator | N3781 | 4.9 (N3797) | __cpp_digit_separator >= 201309 |
'C++11,14 (modern C++)' 카테고리의 다른 글
rvalue reference 가 항상 유익하지 않다? (2) | 2017.04.07 |
---|---|
C++ 11과 C++ 99 를 동시에 지원하기 위해서 feature를 구분할 때 유용한 팁 (0) | 2016.09.07 |
stl : map 과 array 성능비교. (2) | 2016.06.09 |
effective modern c++: 멤버 함수 사용 제한을 delete 키워드로 하는 것이 낫다. (2) | 2016.02.11 |
effective modern c++: typedef 보다는 using (0) | 2016.02.11 |