Skip to content

StandardUsing.en US

FrankHB edited this page Apr 23, 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:

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)
  • 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)

Adopted changes

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

Headers

New headers from C++11 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])
  • <array> (since b218[2011-06-14])
  • <chrono> (since b291[2012-03-07])
  • <forward_list> (since b218[2011-06-14])
  • <type_traits> (since b206[2011-05-03])
  • <typeindex> (since b468[2014-01-20])
  • <tuple> (since b206[2011-05-03])
  • <system_error> (since b476[2014-02-16])
  • <unordered_map> (since b206[2011-05-03])
  • <unordered_set> (since b206[2011-05-03])

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:

  • 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])
  • 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])
  • 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)
  • N2242: Proposed Wording for Variadic Templates (Revision 2) (since b251[2011-10-08])
  • N2249: New Character Types in C++ (since b253[2011-10-18])
  • N2258: Templates Aliases (since b433[2013-08-01])
  • 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 (since b206[2011-05-03])
  • 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])
  • N2541: Unrestricted Unions (Revision 2) (since b569[2015-01-29])
  • 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])

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

  • 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])
  • 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 b593[2015-04-23]) 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
  • 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
  • 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)
  • 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]])
Clone this wiki locally