https://developer.apple.com/xcode/cpp/ View in English [ ] * Global Nav Open Menu Global Nav Close Menu * Apple Developer Search Cancel * Apple Developer * News * Discover * Design * Develop * Distribute * Support * Account * [ ] Cancel [*]Only search within "" Quick Links 5 Quick Links [ ] Xcode Open Menu Close Menu * Xcode 15 * SwiftUI * SwiftData * Resources Download Xcode 15 beta Xcode 14 C++ language support Apple supports C++ with the Apple Clang compiler (included in Xcode) and the libc++ C++ standard library runtime (included in SDKs and operating systems). The compiler and runtime are regularly updated to offer new functionality, including many leading-edge features specified by the ISO C++ standard. Supported features The following tables list support for ISO C++ standard features available on Apple platforms and in the Apple Clang compiler, as well as links to related documentation. While most features are supported by all Apple operating systems, some features depend on specific OS capabilities or require support in the libc++.dylib shared library provided with the OS. Code that uses those features should be guarded by the minimal deployment target check as noted. C++23 Feature Paper Notes De-deprecating volatile compound operations. P2327R1 Available in Xcode 15 Support for #warning P2437R1 Available in Xcode 15 Remove non-encodable wide character literals P2362R3 Available in and multicharacter wide character literals Xcode 15 Delimited escape sequences P2290R3 Available in Xcode 15 Named universal character escapes P2071R2 Available in Xcode 15 Support for UTF-8 as a portable source file P2295R6 Available in encoding Xcode 15 Relax requirements on wchar_t to match P2460R2 Available in existing practices Xcode 15 Available in Multidimensional subscript operator P2128R6 Xcode 14.3 or later Non-literal variables (and labels and gotos) Available in in constexpr functions P2242R3 Xcode 14.3 or later Available in auto(x): decay-copy in the language P0849R8 Xcode 14.3 or later Literal suffix uz, z for size_t, ssize_t P0330R8 Make () in lambdas optional in all cases P1102R2 if consteval P1938R3 Allow duplicate attributes P2156R1 Narrowing contextual conversions to bool P1401R5 Trimming whitespaces before line splicing P2223R2 C++ identifier syntax using unicode standard P1949R7 annex 31 Mixed string literal concatenation P2201R1 Character sets and encodings P2314R4 Consistent character literal encoding P2316R2 Preprocessing directives elifdef and P2334R1 elifndef Extend init-statement to allow P2360R0 alias-declaration Attributes on lambda expressions P2173R1 Make declaration order layout mandated P1847R4 Features implemented in the libc++ library string_view range constructor should be P2499R0 Available in explicit Xcode 15 A more constexpr bitset P2417R2 Available in Xcode 15 forward_like P2445R1 Available in Xcode 15 Making std::unique_ptr constexpr P2273R3 Available in Xcode 15 Add constexpr modifiers to functions Available in to_chars and from_chars for integral types P2291R3 Xcode 15 in header std::string::substr() && P2438R2 Available in Xcode 15 static operator() P1169R4 Available in Xcode 15 std::expected P0323R12 Available in Xcode 15 views::as_rvalue P2446R2 Available in Xcode 15 std::unexpected should have error() as P2549R1 Available in member accessor Xcode 15 Function to mark unreachable code Available in std::unreachable() P0627R6 Xcode 14.3 or later Type trait to detect scoped enumerations P1048R1 std::is_scoped_enum contains() function for basic_string and P1679R3 basic_string_view std::to_underlying for enumerations P1682R3 std::visit() for classes derived from P2162R2 std::variant Prevent overconstraining allocators in P1518R2 container deduction guides Prohibit basic_string and basic_string_view P2166R1 construction from nullptr Require span & basic_string_view to be P2251R1 trivially copyable C++20 Feature Paper Notes Immediate functions (consteval) P1073R3 Available in Xcode 15 P1937R2 Default member initializers for P0683R1 bit-fields Fix const-qualified (const& P0704R1 -qualified) pointers to members Allow lambda-capture [=, this] P0409R2 __VA_OPT__ for comma omission and P0306R4 comma deletion P1042R1 Designated initializers P0329R4 Familiar template-parameter-list P0428R2 syntax for generic lambdas P0734R0 P1084R2 P1141R2 P1616R1 Not supported: papers Concepts P1452R2 P0857R0, P2113R0, P2103R0, P1972R0 DR1496, DR1734, P0848R3 P1980R0 P2493R0 P2092R0 Range-based for statements with P0614R1 initializer ADL and function templates that P0846R0 are not visible const mismatch with defaulted copy P0641R2 constructor P0515R3 P0905R1 P1120R0 Consistent comparison (operator P1185R2 <=>) P1186R3 P1630R1 P1946R0 P1959R0 P2085R0 Relaxing access checking on P0692R1 specializations Default constructible and P0624R2 assignable stateless lambdas Allowing lambdas in unevaluated P0315R4 Not supported: contexts [temp.deduct/9] [[no_unique_address]] attribute P0840R2 [[likely]] and [[unlikely]] P0479R5 attributes Pack expansion in lambda P0780R2 init-capture P1064R0 P1002R1 Relaxations of constexpr P1327R1 restrictions P1330R0 P1331R2 P1668R1 P0784R7 Prohibit aggregates with P1008R1 user-declared constructors Feature test macros P0941R2 explicit(bool): conditionally P0892R2 explicit constructor Signed integers are two's P1236R1 complement char8_t: A type for UTF-8 P0482R6 characters and strings std::is_constant_evaluated P0595R2 Nested inline namespaces P1094R2 Stronger unicode requirements P1041R4 P1139R2 Coroutines P0912R5 Deprecate comma operator in subscripting expressions like a P1161R3 [b,c] Deprecate some problematic uses of P1152R4 volatile [[nodiscard("with reason")]] P1301R4 using enum P1099R5 Permit conversions to arrays of P0388R4 unknown bound constinit P1143R2 Pseudo-destructors end object P0593R6 lifetimes (DR) Implicit move for more local P1825R0 objects and rvalue references (DR) Features implemented in the libc++library Utility functions to implement P0591R4 Available in Xcode 15 uses-allocator construction char8_t: A type for UTF-8 P0482R6 Available in Xcode 15 characters and strings nodiscard in the Library P0600R1 Available in Xcode 15 polymorphic_allocator<> as a P0339R6 Available in Xcode 15 vocabulary type Constexpr for std::complex P0415R1 Available in Xcode 15 Adopt source_location for C++20 P1208R6 Available in Xcode 15 Input Range Adaptors P1035R7 Available in Xcode 15 Views should not be required to be P2325R3 Available in Xcode 15 default constructible Smart pointer creation with P1020R1 Available in Xcode 15 default initialization Superior String Splitting P2210R2 Available in Xcode 15 basic_istream_view::iterator P1638R1 Available in Xcode 15 should not be copyable Output std::chrono::days with 'd' P1650R0 Available in Xcode 15 suffix Ranges adaptors for non-copyable P1862R1 Available in Xcode 15 iterators Rename "_default_init" Functions, P1973R1 Available in Xcode 15 Rev1 elements_view needs its own P1994R1 Available in Xcode 15 sentinel Fix istream_view P2432R1 Available in Xcode 15 Making std::vector constexpr P1004R2 Available in Xcode 14.3 or later Consistent stateful allocator Available in Xcode 14.3 or propagation for operator+ P1165R1 later (basic_string) Support arrays in make_shared and P0674R1 Available in Xcode 14.3 or allocate_shared later Making std::string constexpr P0980R1 Available in Xcode 14.3 or later Consider ATOMIC_FLAG_INIT LWG3659 Available in Xcode 14.3 or undeprecation later char8_t backward compatibility P1423R3 Available in Xcode 14.3 or remediation later Bit-casting object representations P0476R2 Available in Xcode 14.3 or later P0896R4 Available in Xcode 14.3 or later Ranges P2415R2 Available in Xcode 14.3 or later P2281R1 Available in Xcode 14.3 or later std::endian P0463R1 Add constexpr modifiers to functions in and P0202R3 headers Make std::memory_order a scoped P0439R0 enumeration String prefix and suffix checking P0457R2 Transformation trait remove_cvref P0550R2 De-pessimize legacy P0616R0 algorithms with std::move Utility to convert a pointer to a P0653R2 raw pointer Deprecate is_pod P0767R1 Library support for the spaceship P0768R1 (comparison) operator <=> Treating unnecessary decay P0777R1 P0122R7 Thou shalt not specialize std P0551R3 function templates! P0754R2 Comparing unordered containers P0809R0 Constexpr iterator requirements P0858R0 string::reserve should not shrink P0966R1 Checking for existence of an P0458R2 element in associative containers Guaranteed copy elision for P0475R1 piecewise construction Integral power-of-2 operations P0556R3 Reviewing deprecated facilities of Not supported: P0619, C++17 for C++20 P0619R4 Sections D.4, D.7, D.11, D.12, and D.14 Improving the return value of P0646R1 erase-like algorithms Efficient sized delete for P0722R3 variable sized classes Implicit conversion traits and P0758R1 utility functions fpos requirements P0759R1 Add shift to P0769R2 constexpr for swap and swap P0879R0 related functions The identity metafunction P0887R1 Standard library concepts P0898R3 Eradicating unnecessarily explicit P0935R0 default constructors constexpr comparison operators for P1023R0 std::array std::unwrap_ref_decay and P0318R1 std::unwrap_reference Simplified partial function P0356R5 application Supporting Incomplete types In P0357R3 reference_wrapper Fixing operator>>(basic_istream&, P0487R1 CharT*) std::is_constant_evaluated() P0595R2 Variant and optional should P0602R4 propagate copy/move triviality Improving variant's Converting P0608R3 Constructor/Assignment visit: explicit return type for P0655R1 visit std::function move constructor P0771R1 should be noexcept Heterogeneous lookup for unordered P0919R3 containers zero(), min(), and max() P0972R0 should be noexcept constexpr in std::pointer_traits P1006R1 Misc constexpr bits P1032R1 Remove comparison operators of P1085R2 std::span Adopt consistent container erasure P1209R0 from library fundamentals 2 Remove CommonReference requirement P1248R1 from StrictWeakOrdering Making std::underlying_type P0340R3 SFINAE-friendly Well-behaved interpolation for P0811R3 numbers and pointers Usability enhancements for P1024R3 std::span Make create_directory() intuitive P1164R1 signed ssize() functions, unsigned P1227R2 size() functions Traits for [Un]bounded Arrays P1357R1 Mandating the standard library: Clause 16 - Language support P1458R1 library Mandating the standard library P1459R1 Clause 18 - Diagnostics library Mandating the standard library: P1462R1 Clause 20 - Strings library Mandating the standard library: P1464R1 Clause 22 - Iterators library to_array from LFTS with updates P0325R4 Bit operations P0553R4 Math constants P0631R8 More onstexpr containers P0784R7 constexpr invoke P1065R2 Synchronization library Minimum deployment target: (, , P1135R6 macOS 11.0, iOS 14.0, and notification functions on tvOS 14.0, watchOS 7.0 std::atomic) Exposing a narrow contract for P1355R2 ceil2 Relocate endian's specification P1612R1 bind_front should not unwrap P1651R0 reference_wrapper Remove dedicated precalculated P1661R1 hash lookup interface Fixing atomic initialization P0883R2 Range constructor for P1391R4 std::string_view Range constructor for std::span P1394R4 constexpr for numeric algorithms P1645R1 Heterogeneous lookup for unordered P1690R1 containers Minimum deployment target: Add max() to latch and barrier P1865R1 macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0 Concept traits should be named P1871R1 after concepts span should have size_type, not P1872R0 index_type Remove std::weak_equality and P1959R0 std::strong_equality Safe integral comparisons P0586R2 Improving the return value of erase-like algorithms II: free P1115R3 erase/erase if On the names of low-level bit P1956R1 manipulation functions Wording for boolean-testable P1964R2 Fixed-size span construction from P1976R2 dynamic range Remove tuple-like protocol support P2116R0 from fixed-extent span Missing constexpr in std::optional P2231R1 Not supported: changes to and std::variant std::variant C++17 Feature Paper Notes static_assert with no N3928 message Removing trigraphs N4086 typename in a template N4051 template parameter New auto rules for N3922 direct-list-initialization Fold expressions N4295 P0036R0 u8 character literals P0036R0 Nested namespace N4230 definition Attributes for namespaces N4266 and enumerators Allow constant evaluation for all non-type template N4268 arguments Remove deprecated register P0001R1 storage class Remove deprecated bool P0002R1 increment Make exception specifications part of the P0012R1 type system __has_include in P0061R1 preprocessor conditionals [[fallthrough]] attribute P0188R1 P0189R1 [[nodiscard]] attribute P1771R1 (DR) [[maybe_unused]] attribute P0212R1 Aggregate initialization of classes with base P0017R1 classes constexpr lambda P0170R1 expressions Differing begin and end P0184R0 types in range-based for Lambda capture of *this P0018R3 Direct-list-initialization P0138R2 of enums Hexadecimal floating-point P0245R1 literals Using attribute namespaces P0028R4 without repetition Dynamic memory allocation P0035R4 for over-aligned data P0091R3 Template argument P0512R0 deduction for class P0620R0 templates (DR) P0702R1 (DR) Non-type template P0127R2 parameters with auto type Guaranteed copy elision P0135R1 Stricter expression P0145R3 evaluation order P0400R0 Requirement to ignore P0283R2 unknown attributes constexpr if statements P0292R2 Inline variables P0386R2 P0217R3 P0961R1 Structured bindings (DR) P0969R0 (DR) Separate variable and condition for if and P0305R1 switch Matching of template This feature can be source template-parameters to P0522R0 breaking. Should be enabled arguments explicitly with the compiler flag -frelaxed-template-template-args Removing deprecated dynamic exception P0003R5 specifications Features implemented in the libc++library Available in Xcode 15 P0220R1 Minimum deployment target: iOS 17.0, macOS 14.0, watchOS 10.0 and tvOS 17.0. P0219R1 P0218R1 Minimum deployment target: Filesystem library P0392R0 macOS 10.15, iOS 13.0, tvOS 13.0, P0317R1 watchOS 6.0 P0492R2 TransformationTrait Alias N3911 void_t. Invoke function template N4169 std::uncaught_exceptions N4259 TriviallyCopyable N4277 reference_wrapper. Improved insertion interface for unique-key N4279 maps. std::size(), std::empty() N4280 and std::data() Contiguous Iterators N4284 Cleanup for exception-specification N4285 and throw-expression. Improving std::pair and N4387 std::tuple bool_constant N4389 Pass -fno-exceptions compiler flag to back deploy to older OSes. Note shared_mutex N4508 that methods that throw exceptions on failure will abort in this mode. LWG 2228 missing SFINAE N4366 rule Minimal incomplete type support for standard N4510 containers Remove deprecated P0004R1 iostreams aliases. Adopt type traits variable P0006R0 templates for C++17 Polishing P0092R1 Constant view: std::as_const helper P0007R1 function template. Making std::owner_less P0074R0 more flexible Logical type traits rev 2 P0013R1 Re-enabling P0033R1 shared_from_this Adopt not_fn from library P0005R4 fundamentals 2 for C++17 constexpr atomic::is_always P0152R1 _lock_free [nothrow-]swappable traits P0185R1 Fixing a design mistake in P0253R1 the searchers interface An algorithm to clamp a value between a pair of P0025R0 boundary values 3-argument overload to P0030R1 std::hypot Constexpr modifiers for reverse_iterator, P0031R0 move_iterator, array and Range Access Give std::string a non-const .data() member P0272R1 function is_callable, the missing P0077R2 INVOKE related trait Homogeneous interface for P0032R3 variant, any and optional Extending memory P0040R3 management tools C++17 should refer to C11 P0063R3 instead of C99 Splicing maps and sets P0083R3 Emplace return type P0084R2 Minimum deployment target: bad_variant_access and methods that throw it: get and visit require macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0 Variant: a type-safe union P0088R3 for C++17 Pass -fno-exceptions compiler flag to back deploy to older OSes. Note that methods that throw exceptions on failure will abort in this mode. Replacement of class objects containing P0137R1 reference members shared_ptr::weak_type P0163R0 Synopses for the c library P0175R1 Reserve a new library namespace for future P0180R2 standardization make_from_tuple: apply for P0209R2 construction Integrating std::string_view and P0254R2 std::string has_unique_object P0258R2 _representations Adopt selected library fundamentals V2 components P0295R0 for C++17 Minimum deployment target: bad_optional_access and bad_any_cast, and methods that throw them: optional::value and Adopt library fundamentals any_cast require macOS 10.13, V1 TS components for C++17 iOS 12.0, tvOS 12.0, watchOS 5.0 (optional, string_view, P0220R1 any) Pass -fno-exceptions compiler flag to back deploy to older OSes. Note that methods that throw exceptions on failure will abort in this mode. Removing allocator support P0302R1 in std::function Making optional greater P0307R2 equal again Better names for parallel execution policies in P0336R1 C++17 Delete operator= for P0337R0 polymorphic_allocator A nomenclature P0346R1 tweak Fixes for not_fn P0358R1 Temporarily discourage P0371R1 memory_order_consume Making variant greater P0393R3 equal Removing deprecated exception specifications P0003R5 from C++17 Minimum deployment target: For integral types, macOS 10.15, Elementary string iOS 13.0, tvOS 13.0, watchOS 6.0 conversions std::to_chars, P0067R5 std::from_chars For floating-point types, macOS 13.3, iOS 16.3, tvOS 16.3, watchOS 9.3 Literal suffixes for P0403R1 basic_string_view Merging shared_ptr changes from Library Fundamentals P0414R2 to C++17 Constexpr for P0426R1 std::char_traits Resolving LWG Issues re P0435R1 common_type Correcting library usage P0503R0 of "literal type" Revisiting in-place tag types for any/optional/ P0504R0 variant Wording for GB 50 - P0505R0 constexpr for chrono Updating "Restrictions on P0509R1 exception handling" Disallowing references, incomplete types, arrays, P0510R0 and empty variants Poisoning the hash P0513R0 Clarify that shared_future's copy P0516R0 operations have wide contracts Make future_error P0517R0 constructible shared_ptr use_count/ P0521R0 unique Variadic lock guard(rev 5) P0156R2 A byte type definition P0298R3 File system library on non-POSIX-like operating P0430R2 systems Integrating template deduction for class P0433R2 templates into the standard library common_type and duration P0548R1 Resolving atomic named P0558R1 base class inconsistencies noexcept for hash P0599R1 functions Resolving GB 55, US 84, US P0604R0 85, US 86 Some improvements to class template argument P0739R0 deduction integration into the standard library C++14 Feature Paper Notes Tweak to certain c++ contextual conversions N3323 Binary literals N3472 decltype(auto) N3638 Return type deduction for normal functions Initialized lambda captures N3648 Generic lambdas N3649 Variable templates N3651 Relaxing requirements on constexpr functions N3652 Member initializers and aggregates N3653 Clarifying memory allocation N3664 [[deprecated]] attribute N3760 Single quotation mark as digit separator N3781 Sized deallocation (delete and delete[]) N3778 Features implemented in the libc++library Terminology for container element requirements - Rev 1 N3346 Making operator functors greater<> N3421 std::result_of and SFINAE N3462 integral_constant improvements N3545 Null forward iterators N3644 std::exchange() N3668 Compile-time integer sequences N3658 Addressing tuples by type N3670 Making non-modifying sequence operations more robust N3671 make_unique N3656 Quoted Strings N3654 User-defined Literals N3642 TransformationTraits Redux (excluding part 4) N3655 Heterogeneous comparison lookup N3657 Fixing constexpr member functions without const N3669 Shared locking N3659 User-defined literals for std::complex N3779 Discouraging rand() N3924 Consistent metafunction aliases N3887 Rename shared_mutex to shared_timed_mutex N3891 N3469 Constexpr library additions: chrono, containers, N3470 utilities, complex numbers, functional N3471 N3302 N3789 C++11 Feature Paper Notes N2118 Rvalue references P1825R0 (DR ) Rvalue references for *this N2439 Initialization of class objects by rvalues N1610 Non-static data member initializers N2756 Variadic templates N2242 Extending variadic template template parameters N2555 N2672 P1009R2 (DR Initializer lists ) P1957R2 (DR ) Static assertions N1720 auto-typed variables N1984 Multi-declarator auto N1737 Removal of auto as a storage-class specifier N2546 New function declarator syntax N2541 Declared type of an expression N2343 Incomplete return types N3276 Right angle brackets N1757 Default template arguments for function templates DR226 Solving the SFINAE problem for expressions DR339 Alias templates N2258 Extern templates N1987 Null pointer constant N2431 Strongly-typed enums N2347 Forward declarations for enums N2764 DR1206 Standardized attribute syntax N2761 N2235 ConstExpr: generalized constant expressions P0859R0 (DR ) Alignment support N2341 Conditionally-support behavior N1627 Changing undefined behavior into diagnosable errors N1727 Delegating constructors N1986 N2540 Inheriting constructors P0136R1 (DR ) Explicit conversion operators N2437 New character types N2249 Unicode string literals N2442 Raw string literals N2442 Universal character names in literals N2170 User-defined literals N2765 Standard Layout Types N2342 N2346 Defaulted functions P1286R2 (DR ) Deleted functions N2346 Extended friend declarations N1791 Extending sizeof N2253 DR850 Inline namespaces N2535 Unrestricted unions N2544 Local and unnamed types as template arguments N2657 N2930 Range-based for P0962R1 (DR ) N2928 Explicit virtual overrides N3206 N3272 Allowing move constructors to throw [noexcept] N3050 Defining move special member functions N3053 Concurrency Sequence points N2239 Atomic operations N2427 Strong compare and exchange N2748 Bidirectional fences N2752 Memory model N2429 Data-dependency ordering: atomics and memory model N2664 Propagating exceptions N2179 Allow atomics use in signal handlers N2547 Thread-local storage N2659 Dynamic initialization and destruction with N2660 concurrency C99 Features in C++11 __func__ predefined identifier N2340 C99 preprocessor N1653 long long N1811 C++98/03 Clang and libc++ supports all features of the ISO C++ 1998 standard and the defects addressed in the ISO C++ 2003 standard. Related resources Videos * + Mix Swift and C++ + Simplify C++ templates with concepts from WWDC22 + What's New in Clang and LLVM from WWDC19 Release notes and documentation * + Using C++ APIs in Swift and Swift APIs in C++ + Xcode 15 beta 1 Release Notes (Apple Clang and libc++) + Xcode 14.3 Release Notes (Apple Clang and libc++) + Getting started with Metal-cpp * Older release notes: + MacOS Monterey 12.3 Release Notes (libc++) + Xcode 14 Release Notes (Apple Clang) Xcode documentation Find details and step-by-step instructions on how to use Xcode. Read documentation Documentation Browse the latest documentation, including tutorials, sample code, articles, and API reference. Read documentation Videos Discover the latest in Apple technologies presented at WWDC and other events. Watch videos Forums Ask questions and discuss development topics with Apple engineers and other developers. View forums Developer Footer Xcode C++ Language Support [ ] Platforms Open Menu Close Menu * iOS * iPadOS * macOS * tvOS * watchOS * visionOS [ ] Tools Open Menu Close Menu * Swift * SwiftUI * Swift Playgrounds * TestFlight * Xcode * Xcode Cloud * SF Symbols [ ] Topics & Technologies Open Menu Close Menu * Accessibility * Accessories * App Extensions * App Store * Audio & Video * Augmented Reality * Business * Design * Distribution * Education * Fonts * Games * Health & Fitness * In-App Purchase * Localization * Maps & Location * Machine Learning * Open Source * Security * Safari & Web [ ] Resources Open Menu Close Menu * Documentation * Curriculum * Downloads * Forums * Videos [ ] Support Open Menu Close Menu * Support Articles * Contact Us * Bug Reporting * System Status [ ] Account Open Menu Close Menu * Apple Developer * App Store Connect * Certificates, IDs, & Profiles * Feedback Assistant [ ] Programs Open Menu Close Menu * Apple Developer Program * Apple Developer Enterprise Program * App Store Small Business Program * MFi Program * News Partner Program * Video Partner Program * Security Bounty Program * Security Research Device Program [ ] Events Open Menu Close Menu * Events Overview * App Accelerators * App Store Awards * Apple Design Awards * Apple Developer Academies * Entrepreneur Camp * Ask Apple * Tech Talks * WWDC To view the latest developer news, visit News and Updates. ( ) Light ( ) Dark ( ) Auto [] Copyright (c) 2023 Apple Inc. All rights reserved. Terms of Use Privacy Policy Agreements and Guidelines