Skip to content

StandardUsing.en US

FrankHB edited this page May 9, 2015 · 48 revisions

Introduction

This is the page concerning which subset of the standard features could be used in this project.

Several C++0x features are used since 2011-05-03, build 206. These features are also in ISO C++11(ISO/IEC 14882:2011). Previously C++03 with TR1(ISO/IEC TR 19768:2007) was used.

C++11 is now default to conform. All C++03 features conflicted with C++11 are forbidden. TR1 features are avoided and substituted by their C++11 counterparts as possible.

However, the codebase is still largely based on C++03(ISO/IEC 14882:2003).

Some core language feature have be fallback in C++03 (e.g. constexpr) or library (e.g. alignof), mostly workaround in ydef.h, as well as some optional extensions (e.g. __has_feature and __builtin_expect) wrapped as implementation details.

Following are the features introduced explicitly to clearify dependences on the language implementations. The date is in UTC+8.

General status

C++11 core language features and headers below now could be used.

Reviewed

The following editor report has been fully reviewed (b593[2015-04-23]), which means all the resolutions in the paper are categorized in the following clauses:

NOTE There might exist minor differences between editor's report and the paper in the list, e.g. N3059 (rev 5.2) in N3091 is (rev 5.1). For these cases, only the later revisions at the point of time are reviewed and probably would not be updated unless necessary.

To be done

Reviewing of following defect reports are work in progress.

  • CWG446: Does an lvalue-to-rvalue conversion on the "?" operator produce a temporary?
  • CWG462: Lifetime of temporaries bound to comma expressions

Reviewing of following editor reports are work in progress.

No actions

There are nothing to do of coding and further documentations for some resolutions.

These post-C++03 draft resolutions would never be depended on because they are only intended useful for language implementations and there shall be no compatibility problems for conforming code (revised b593[2015-04-23]):

  • N2194: decltype for the C++0x Standard Library

These post-C++03 draft resolutions are outdated, purely editorial or conceptional, so no actions could be taken (revised b593[2015-04-23]):

  • CWG452: Wording nit on description of this, partially adopted
  • CWG627: Values behaving as types
  • LWG628: Inconsistent definition of basic_regex constructor
  • LWG640: 27.6.2.5.2 does not handle (unsigned) long long (i.e. for ostream::operator<<), outdated
  • N2775: Small library thread-safety revisions

These features was once adopted by the working paper but later was superseded or removed away, so no actions would be taken:

  • CWG86: Lifetime of temporaries in query expressions (resolved by CWG446 and CWG462)
  • LWG1029: Specialized algorithms for memory management need to be concept-constrained templates
  • LWG1001: Pointers, concepts and headers (see LWG1178)
  • N2192: Variadic Templates for the C++0x Standard Library (Revision 1) (see N2242)
  • N2525: Allocator-specific Swap and Move Behavior (i.e. allocator_propagate_*)
  • N2550: Lambda Expressions and Closures: Wording for Monomorphic Lambdas (Revision 4) (see N2927)
  • N2620: Concepts for the C++0x Standard Library: Diagnostics library
  • N2736: Concepts for the C++0x Standard Library: Numerics (Revision 3)
  • N2755: Concepts for the C++0x Standard Library: Chapter 17 -Introduction (Revision 2)
  • N2758: Iterator Concepts for the C++0x Standard Library (Revision 5)
  • N2759: Concepts for the C++0x Standard Library: Algorithms (Revision 5)
  • N2768: Allocator Concepts, part 1 (revision 2)
  • N2770: Concepts for the C++0x Standard Library: Utilities (Revision 5)
  • N2773: Proposed Wording for Concepts (Revision 9)
  • N2774: Foundational Concepts for the C++0x Standard Library (Revision 5)
  • N2776: Concepts for the C++0x Standard Library: Containers (Revision 4)
  • N2777: Concepts for the C++0x Standard Library: Iterators (Revision 4)
  • N2778: Wording for range-based for-loop (revision 4) (see N2930)
  • N2779: Concepts for Clause 18: Part 2
  • N2780: Named Requirements for C++0X Concepts, version 2
  • N2786: Simplifying unique_copy (Revision 1)

There are actions taken by the committee to remove away some former working draft features which are never used here:

  • N2549: Excision of Clause 31 (i.e. <date_time>)

Adopted changes

C++11 core language features and headers below now are being used.

Imported TR1 Headers

TR1 headers imported to C++11 are used:

  • <array> (since b218[2011-06-14])
  • <type_traits> (since b206[2011-05-03])
  • <tuple> (since b206[2011-05-03])
  • <unordered_map> (since b206[2011-05-03])
  • <unordered_set> (since b206[2011-05-03])

Headers

New non-TR1 headers from C++11 are used:

  • <atomic> (for all platforms from b590[2015-04-03]; for platforms supporting multithreading since b328[2011-07-25]; for platform MinGW32 since b299[2013-04-08])
  • <chrono> (since b291[2012-03-07])
  • <forward_list> (since b218[2011-06-14]; see N2543)
  • <typeindex> (since b468[2014-01-20])
  • <system_error> (since b476[2014-02-16]; see N2241)

For all implementations supporting multithreading, these headers are also used:

  • <condition_variable> (since b328[2011-07-25]; for platform MinGW32 since b299[2013-04-08])
  • <future> (since b520[2014-07-23])
  • <mutex> (since b328[2011-07-25]; for platform MinGW32 since b299[2013-04-08])
  • <thread> (since b328[2011-07-25]; for platform MinGW32 since b299[2013-04-08])

Note: LWG1360 specified single-threaded program should be able to use <atomic>, and resolved by N3256. However, the current YSLib doesn't require it for single-threaded programs.

Technicle Reports

TR1 features was once used, but now retired and corresponding ISO C++ features shall be used, since they are imported from TR1:

  • TR1 <type_traits> including metafunctions and std::tr1::aligned_storage (since b175[2010-12-23])

Adopted features

C++11 library features used indirectly (not required, but with design in mind that could make more interface usable, e.g. macro substitution or template instantiations):

  • N2345: Placement Insert for Containers (Revision 2) (since b338[2012-09-13])
  • N2761: Towards support for attributes in C++ (Revision 6)

Other C++11 core and library features used directly:

  • CWG226: Default template arguments for function templates (since b387[2013-03-11])
  • CWG339: Overload resolution in operand of sizeof in constant expression (since b591[2015-04-10])
  • CWG382: Allow typename outside of templates (b421[2013-07-03])
  • CWG637: Sequencing rules and example disagree (since b297[2012-03-27])
    • CWG222: Sequence points and lvalue-returning operators
  • CWG1104: Global-scope template arguments vs the <: digraph (since b493[2014-04-16])
  • LWG534: Missing basic_string members (since b315[2012-06-08])
  • LWG993: _Exit needs better specification (since b565[2015-01-16])
  • LWG1040: Make integral_constant objects useable in integral-constant-expressions (since b590[2015-04-10])
  • LWG1040: Clarify possible sameness of associative container's iterator and const_iterator (since b496[2014-05-01])
  • LWG1178: Header dependencies (since b338[2012-09-13])
    • LWG343: Unspecified library header dependencies (see also N2259)
  • LWG1192: basic_string missing definitions for cbegin / cend / crbegin / crend (since b546[2014-10-17])
  • LWG1255: declval should be added to the library (since b260[2011-11-14])
  • LWG1382: pair and tuple constructors should forward arguments (since b206[2011-05-03])
  • N1653: Working draft changes for C99 preprocessor synchronization (since b257[2011-11-04]; used GCC extensions previously for variadic macros and empty macro arguments only)
  • N1720: Proposal to Add Static Assertions to the Core Language (Revision 3) (since b206[2011-05-03])
  • N1757: Right Angle Brackets (Revision 1) (since b206[2011-05-03])
  • N1811: Adding the long long type to C++ (Revision 3) (since b206[2011-05-03])
  • N1822: A Proposal to add a max significant decimal digits value to the C++ Standard Library Numeric limits (since b260[2011-11-12]; i.e. numeric_limits::max_digits10)
  • N1836: Draft Technical Report on C++ Library Extensions (Built-in type traits) (since b206[2011-05-03])
  • cbegin/cend/crbegin/crend from N1913: A Proposal to Improve const_iterator Use (version 2) (since b206[2011-05-03])
  • N1984: Deducing the type of variable from its initializer expression (revision 4) (since b206[2011-05-03]; i.e. auto-typed variables)
  • N1986: Delegating Constructors (revision 3) (since b311[2011-05-25])
  • N1987: Adding "extern template" (version 2) (since b206[2011-05-03])
  • N2179: Language Support for Transporting Exceptions between Threads (since b538[2014-09-28])
  • N2235: Generalized Constant Expressions—Revision 5 (since b246[2011-09-23]; i.e. constexpr)
  • N2238: Minimal Unicode support for the standard library (revision 3) (since b253[2011-10-18])
  • N2239: A finer-grained alternative to sequence points (revised) (since b297[2012-03-27]; notably order of aggregate initialization)
  • N2240: Two missing traits: enable_if and conditional, added specification when B is false (since b206[2011-05-03])
  • N2241: Diagnostics Enhancements for C++0x (Rev. 1), reworded (since b476[2014-02-16]; i.e. <system_error>)
  • N2242: Proposed Wording for Variadic Templates (Revision 2) (since b251[2011-10-08])
  • N2244: Wording for decay, make_pair and make_tuple (since b206[2011-05-03])
  • features from N2246: 2 of the least crazy ideas for the standard library in C++0x (i.e. next/prev/is_sorted_until/is_heap_until)
    • next/prev (since b375[2013-01-22])
  • N2249: New Character Types in C++, library part reworded (since b253[2011-10-18])
  • N2255: Minor Modifications to the type traits Wording Revision 2, reworded (since b206[2011-05-03])
  • N2258: Templates Aliases (since b433[2013-08-01])
  • N2259: Specify header dependency for <iostream> (since b338[2012-09-13]; see also LWG343)
  • N2299: Concatenating tuples, with modification (since b303[2012-04-23])
  • features(e.g. alignof) from N2341: Adding Alignment Support to the C++ Programming Language / Wording
    • std::aligned_storage used instead of std::tr1::aligned_storage since b206[2011-05-03]
    • other features except std::aligned_union used since b315[2012-06-08]
  • N2342: POD's Revisited; Resolving Core Issue 568 (Revision 5) (since b206[2011-05-03])
    • CWG568: Definition of POD is too strict
  • N2343: Decltype (revision 7) (since b206[2011-05-03])
  • N2346: Defaulted and Deleted Functions (since b207[2011-05-05])
  • N2347: Strongly Typed Enums (revision 3), with modification (since b261[2011-11-19])
  • N2348: Wording for std::numeric_limits<T>::lowest() (since b242[2011-09-16])
  • N2349: Constant Expressions in the Standard Library — Revision 2, with modification (since b260[2011-11-12])
  • N2350: Container insert/erase and iterator constness (Revision 1) (since b531[2014-08-31])
  • N2431: A name for the null pointer: nullptr (revision 4) (since b206[2011-05-03]; compatible layer introduced since b204[2011-04-26])
  • N2437: Explicit Conversion Operator Draft Working Paper (revision 3) (since b260[2011-11-15])
  • N2439: Extending move semantics to *this (revised wording) (since b591[2015-04-11])
  • Unicode string literals from N2442: Raw and Unicode String Literals; Unified Proposal (Rev. 2) (since b253[2011-10-18])
  • N2442: Raw and Unicode String Literals; Unified Proposal (Rev. 2) (since b434[2013-08-04])
  • N2535: Namespace Association ("inline namespace") (since b427[2013-07-11])
  • N2540: Inheriting Constructors (revision 5) (since b538[2014-09-24])
  • N2541: New Function Declarator Syntax Wording (since b207[2011-05-05])
  • N2543: STL singly linked lists (revision 3) (since b218[2011-06-04]; i.e. <forward_list>)
  • N2544: Unrestricted Unions (Revision 2) (since b569[2015-01-29])
  • N2546: Removal of auto as a storage-class specifier (since b206[2011-05-03])
    • CWG629: auto parsing ambiguity
  • N2559: Nesting Exception Objects (Revision 1) (since b477[2014-02-19])
    • CWG819: rethrow_if_nested (since b477[2014-02-19])
  • N2634: Solving the SFINAE problem for expressions (since b591[2015-04-10])
  • N2672: Initializer List proposed wording (since b297[2012-03-27])
  • N2709: Packaging Tasks for Asynchronous Execution (since b520[2014-07-23]; i.e. packaged_task)
  • N2756: Non-static data member initializers (since b360[2013-04-29])
  • N2844: Fixing a Safety Problem with Rvalue References: Proposed Wording (Revision 1) (since b206[2011-05-03])
    • CWG1138: Rvalue-ness check for rvalue reference binding is wrong (since b206[2011-05-03])
  • N2927: New wording for C++0x Lambdas (rev. 2) (since b206[2011-05-03])
  • N2930: Range-Based For Loop Wording (Without Concepts) (since b316[2011-06-11])
  • features from N2982: Allocators post Removal of C++ Concepts (Rev 1) (since b592[2015-04-19])
    • std::addressof used since b288[2012-02-26]
    • std::allocator_traits used since b592[2015-04-19]
  • N3050: Allowing Move Constructors to Throw (Rev. 1) (since b319[2012-06-24]; i.e. noexcept and std::move_if_noexcept)
  • N3052: Converting Lambdas to Function Pointers (since b360[2012-12-07])
  • features except in <type_traits> from N3053: Defining Move Special Member Functions (since b230[2011-08-07])
  • N3143: Proposed wording for US 90 (since b206[2011-05-03])
  • N3272: Follow-up on override control (since b311[2011-05-25])

Tentatively applied

All adopted changes are confirmed being included in the newest working paper and would not be removed in future unless they are not in the working paper or published standard any longer.

The conformance of following stronger restrictions beyond C++11 are concerned and took into account:

  • CWG1629: Can a closure class be a literal type?
  • CWG1672: Layout compatibility with multiple empty bases

Beyond C++11 core and library features used conditionally:

  • LWG2285: make_reverse_iterator (since b595[2015-05-01])
  • N3478: Core Issue 1512: Pointer comparison vs qualification conversions (since b562[2014-12-22])
    • CWG73: Pointer equality
    • CWG1512: Pointer comparison vs qualification conversions
  • N3493: Compile-time integer sequences (since b589[2015-04-03])
  • N3655: TransformationTraits Redux, v2 (since b595[2015-05-01])
  • N4200: Feature-testing recommendations for C++ (since b591[2015-04-15])

Tentatively not applied

These post-C++03 library resolutions are not depended on currently (revised b595[2015-05-02]) but confirmed still being compatible:

  • LWG531: array forms of unformatted input functions (i.e. for istream::get)
  • LWG551: <ccomplex>
  • LWG566: array forms of unformatted input function undefined for zero-element arrays (i.e. for istream::get)
  • LWG643: Impossible "as if" clauses
  • LWG646: const incorrect match_result members
  • LWG659: istreambuf_iterator should have an operator->()
  • LWG900: Stream move-assignment
  • LWG911: I/O streams and move/swap semantic
  • N1981: Uniform Use of std::string Revision 1
  • N1990: Proposed Text for minmax (N1840) (i.e. minmax and minmax_element in <algorithm>)
  • N1991: Proposed Text for defaultfloat (N1842) (i.e. defaultfloat in <ios>)
  • N2007: Proposed Library Additions for Code Conversion
  • N2253: Extending sizeof to apply to non-static data members without an object (revision 1)
  • N2292: Standard Library Applications for Deleted Functions
  • N2308: Adding allocator support to std::function for C++0x, with modification
  • N2321: Enhancing the time_get facet for POSIX® compatibility, Revision 2
  • N2340: C99 Compatibility : __func__ and predeclared identifiers (revision 2)
  • N2351: Improving shared_ptr for C++0x, Revision 2
  • N2353: A Specification for vector<bool>
  • N2530: Making It Easier to Use std::type_info as an Index in an Associative Container (i.e. type_info::hash_code)
  • N2547: Allow atomics use in signal handlers
  • N2554: The Scoped Allocator Model (Rev 2)
  • N2764: Forward declaration of enumerations (rev. 3)
  • N2760: Input/Output Library Thread Safety
  • N2765: User-defined Literals (aka. Extensible Literals (revision 5))
  • N2782: C++ Data-Dependency Ordering: Function Annotation (i.e. [[carries_dependency]])
  • N3059: Proposal to simplify pair (rev 5.2) (i.e. piecewise_construct_t, etc.)
    • LWG1321: scoped_allocator_adaptor construct and destroy don't use allocator_traits
Clone this wiki locally