Files
cppdraft_translate/cppdraft/conforming.md
2025-10-25 03:02:53 +03:00

581 lines
27 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[conforming]
# 16 Library introduction [[library]](./#library)
## 16.4 Library-wide requirements [[requirements]](requirements#conforming)
### 16.4.6 Conforming implementations [conforming]
#### [16.4.6.1](#overview) Overview [[conforming.overview]](conforming.overview)
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3589)
Subclause [conforming] describes the constraints upon, and latitude of, implementations of the C++ standard library[.](#overview-1.sentence-1)
[2](#overview-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3592)
An implementation's use of
- [(2.1)](#overview-2.1)
headers is discussed in [[res.on.headers]](#res.on.headers "16.4.6.2Headers"),
- [(2.2)](#overview-2.2)
macros in [[res.on.macro.definitions]](#res.on.macro.definitions "16.4.6.3Restrictions on macro definitions"),
- [(2.3)](#overview-2.3)
non-member functions in [[global.functions]](#global.functions "16.4.6.4Non-member functions"),
- [(2.4)](#overview-2.4)
member functions in [[member.functions]](#member.functions "16.4.6.5Member functions"),
- [(2.5)](#overview-2.5)
data race avoidance in [[res.on.data.races]](#res.on.data.races "16.4.6.10Data race avoidance"),
- [(2.6)](#overview-2.6)
access specifiers in [[protection.within.classes]](#protection.within.classes "16.4.6.12Protection within classes"),
- [(2.7)](#overview-2.7)
class derivation in [[derivation]](#derivation "16.4.6.13Derived classes"),
- [(2.8)](#overview-2.8)
exceptions in [[res.on.exception.handling]](#res.on.exception.handling "16.4.6.14Restrictions on exception handling"), and
- [(2.9)](#overview-2.9)
contract assertions in [[res.contract.assertions]](#res.contract.assertions "16.4.6.15Contract assertions")[.](#overview-2.sentence-1)
#### [16.4.6.2](#res.on.headers) Headers [[res.on.headers]](res.on.headers)
[1](#res.on.headers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3608)
A C++ header may include other C++ headers[.](#res.on.headers-1.sentence-1)
A C++ header shall provide the declarations and definitions that appear in its
synopsis[.](#res.on.headers-1.sentence-2)
A C++ header shown in its synopsis as including other C++ headers
shall provide the declarations and definitions that appear in the synopses of
those other headers[.](#res.on.headers-1.sentence-3)
[2](#res.on.headers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3615)
Certain types and macros are defined in more than one header[.](#res.on.headers-2.sentence-1)
Every such entity shall be defined such that any header that defines it may be
included after any other header that also defines it ([[basic.def.odr]](basic.def.odr "6.3One-definition rule"))[.](#res.on.headers-2.sentence-2)
[3](#res.on.headers-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3620)
The [C standard library headers](support.c.headers "17.15C headers[support.c.headers]") shall include only their corresponding C++ standard library header,
as described in [[headers]](headers "16.4.2.3Headers")[.](#res.on.headers-3.sentence-1)
#### [16.4.6.3](#res.on.macro.definitions) Restrictions on macro definitions [[res.on.macro.definitions]](res.on.macro.definitions)
[1](#res.on.macro.definitions-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3628)
The names and global function signatures described in [[contents]](contents "16.4.2.2Library contents") are
reserved to the implementation[.](#res.on.macro.definitions-1.sentence-1)
[2](#res.on.macro.definitions-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3637)
All object-like macros defined by the C standard library and described in this
Clause as expanding to integral constant expressions are also suitable for use
in #if preprocessing directives, unless
explicitly stated otherwise[.](#res.on.macro.definitions-2.sentence-1)
#### [16.4.6.4](#global.functions) Non-member functions [[global.functions]](global.functions)
[1](#global.functions-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3645)
It is unspecified whether any
non-member
functions in the C++ standard library are defined as[inline](dcl.inline "9.2.8The inline specifier[dcl.inline]")[.](#global.functions-1.sentence-1)
[2](#global.functions-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3651)
A call to a non-member function signature
described in [[support]](support "17Language support library") through [[exec]](exec "33Execution control library") and[[depr]](depr "Annex D(normative)Compatibility features") shall behave as if the implementation declared no additional
non-member function signatures[.](#global.functions-2.sentence-1)[155](#footnote-155 "A valid C++ program always calls the expected library non-member function. An implementation can also define additional non-member functions that would otherwise not be called by a valid C++ program.")
[3](#global.functions-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3663)
An implementation shall not declare a non-member function signature
with additional default arguments[.](#global.functions-3.sentence-1)
[4](#global.functions-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3667)
Unless otherwise specified,
calls made by functions in the standard library to non-operator, non-member functions
do not use functions from another namespace which are found through
argument-dependent name lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4Argument-dependent name lookup"))[.](#global.functions-4.sentence-1)
[*Note [1](#global.functions-note-1)*:
The phrase “unless otherwise specified” applies to cases such as
the swappable with requirements ([[swappable.requirements]](swappable.requirements "16.4.4.3Swappable requirements"))[.](#global.functions-4.sentence-2)
The exception for overloaded operators allows argument-dependent lookup
in cases like that of[ostream_iterator::operator=](ostream.iterator.ops#lib:ostream_iterator,operator= "24.6.3.3Operations[ostream.iterator.ops]"):
*Effects*: **out_stream* << value;if (*delim* != 0)**out_stream* << *delim*;return *this;
— *end note*]
[155)](#footnote-155)[155)](#footnoteref-155)
A valid C++ program always
calls the expected library non-member function[.](#footnote-155.sentence-1)
An implementation can
also define additional non-member functions that would otherwise not
be called by a valid C++ program[.](#footnote-155.sentence-2)
#### [16.4.6.5](#member.functions) Member functions [[member.functions]](member.functions)
[1](#member.functions-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3690)
It is unspecified whether any member functions in the C++ standard library are defined as[inline](dcl.inline "9.2.8The inline specifier[dcl.inline]")[.](#member.functions-1.sentence-1)
[2](#member.functions-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3694)
For a non-virtual member function described in the C++ standard library,
an implementation may declare a different set of member function signatures,
provided that any call to the member function that would select
an overload from the set of declarations described in this document
behaves as if that overload were selected[.](#member.functions-2.sentence-1)
[*Note [1](#member.functions-note-1)*:
For instance, an implementation can add parameters with default values,
or replace a member function with default arguments
with two or more member functions with equivalent behavior,
or add additional signatures for a member function name[.](#member.functions-2.sentence-2)
— *end note*]
#### [16.4.6.6](#hidden.friends) Friend functions [[hidden.friends]](hidden.friends)
[1](#hidden.friends-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3709)
Whenever this document specifies
a friend declaration of a function or function template
within a class or class template definition,
that declaration shall be
the only declaration of that function or function template
provided by an implementation[.](#hidden.friends-1.sentence-1)
[*Note [1](#hidden.friends-note-1)*:
In particular,
a conforming implementation does not provide
any additional declarations of that function or function template
at namespace scope[.](#hidden.friends-1.sentence-2)
— *end note*]
[*Note [2](#hidden.friends-note-2)*:
Such a friend function or function template declaration
is known as a hidden friend,
as it is visible neither
to ordinary unqualified lookup ([[basic.lookup.unqual]](basic.lookup.unqual "6.5.3Unqualified name lookup")) nor
to qualified lookup ([[basic.lookup.qual]](basic.lookup.qual "6.5.5Qualified name lookup"))[.](#hidden.friends-1.sentence-3)
— *end note*]
#### [16.4.6.7](#constexpr.functions) Constexpr functions and constructors [[constexpr.functions]](constexpr.functions)
[1](#constexpr.functions-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3732)
This document explicitly requires that certain standard library functions areconstexpr ([[dcl.constexpr]](dcl.constexpr "9.2.6The constexpr and consteval specifiers"))[.](#constexpr.functions-1.sentence-1)
An implementation shall not declare
any standard library function signature as constexpr except for those where
it is explicitly required[.](#constexpr.functions-1.sentence-2)
Within any header that provides any non-defining declarations of constexpr
functions or constructors an implementation shall provide corresponding definitions[.](#constexpr.functions-1.sentence-3)
#### [16.4.6.8](#algorithm.stable) Requirements for stable algorithms [[algorithm.stable]](algorithm.stable)
[1](#algorithm.stable-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3742)
When the requirements for an algorithm state that it is “stable” without further elaboration,
it means:
- [(1.1)](#algorithm.stable-1.1)
For the sort algorithms the relative order of equivalent
elements is preserved[.](#algorithm.stable-1.1.sentence-1)
- [(1.2)](#algorithm.stable-1.2)
For the remove and copy algorithms the relative order of
the elements that are not removed is preserved[.](#algorithm.stable-1.2.sentence-1)
- [(1.3)](#algorithm.stable-1.3)
For the merge algorithms, for equivalent elements in
the original two ranges, the elements from the first range (preserving their
original order) precede the elements from the second range (preserving their
original order)[.](#algorithm.stable-1.3.sentence-1)
#### [16.4.6.9](#reentrancy) Reentrancy [[reentrancy]](reentrancy)
[1](#reentrancy-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3762)
Except where explicitly specified in this document, it is implementation-defined which functions in the C++ standard
library may be recursively reentered[.](#reentrancy-1.sentence-1)
#### [16.4.6.10](#res.on.data.races) Data race avoidance [[res.on.data.races]](res.on.data.races)
[1](#res.on.data.races-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3769)
This subclause specifies requirements that implementations shall meet to prevent[data races](intro.multithread#def:data_race "6.10.2Multi-threaded executions and data races[intro.multithread]")[.](#res.on.data.races-1.sentence-1)
Every standard library function shall meet each requirement unless otherwise specified[.](#res.on.data.races-1.sentence-2)
Implementations may prevent data races in cases other than those specified below[.](#res.on.data.races-1.sentence-3)
[2](#res.on.data.races-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3775)
A C++ standard library function shall not directly or indirectly access
objects ([[intro.multithread]](intro.multithread "6.10.2Multi-threaded executions and data races")) accessible by threads other than the current thread
unless the objects are accessed directly or indirectly via the function's arguments,
including this[.](#res.on.data.races-2.sentence-1)
[3](#res.on.data.races-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3781)
A C++ standard library function shall not directly or indirectly modify
objects ([[intro.multithread]](intro.multithread "6.10.2Multi-threaded executions and data races")) accessible by threads other than the current thread
unless the objects are accessed directly or indirectly via the function's non-const
arguments, including this[.](#res.on.data.races-3.sentence-1)
[4](#res.on.data.races-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3787)
[*Note [1](#res.on.data.races-note-1)*:
This means, for example, that implementations can't use an object with static storage duration for
internal purposes without synchronization because doing so can cause a data race even in
programs that do not explicitly share objects between threads[.](#res.on.data.races-4.sentence-1)
— *end note*]
[5](#res.on.data.races-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3794)
A C++ standard library function shall not access objects indirectly accessible via its
arguments or via elements of its container arguments except by invoking functions
required by its specification on those container elements[.](#res.on.data.races-5.sentence-1)
[6](#res.on.data.races-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3799)
Operations on iterators obtained by calling a standard library container or string
member function may access the underlying container, but shall not modify it[.](#res.on.data.races-6.sentence-1)
[*Note [2](#res.on.data.races-note-2)*:
In particular, container operations that invalidate iterators conflict
with operations on iterators associated with that container[.](#res.on.data.races-6.sentence-2)
— *end note*]
[7](#res.on.data.races-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3807)
Implementations may share their own internal objects between threads if the objects are
not visible to users and are protected against data races[.](#res.on.data.races-7.sentence-1)
[8](#res.on.data.races-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3811)
Unless otherwise specified, C++ standard library functions shall perform all operations
solely within the current thread if those operations have effects that are[visible](intro.multithread#def:side_effects,visible "6.10.2Multi-threaded executions and data races[intro.multithread]") to users[.](#res.on.data.races-8.sentence-1)
[9](#res.on.data.races-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3816)
[*Note [3](#res.on.data.races-note-3)*:
This allows implementations to parallelize operations if there are no visibleside effects[.](#res.on.data.races-9.sentence-1)
— *end note*]
#### [16.4.6.11](#library.class.props) Properties of library classes [[library.class.props]](library.class.props)
[1](#library.class.props-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3825)
Unless explicitly stated otherwise, it is unspecified whether any class
described in [[support]](support "17Language support library") through [[exec]](exec "33Execution control library") and[[depr]](depr "Annex D(normative)Compatibility features") is a trivially copyable class, a standard-layout class, or an
implicit-lifetime class ([[class.prop]](class.prop "11.2Properties of classes"))[.](#library.class.props-1.sentence-1)
[2](#library.class.props-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3831)
Unless explicitly stated otherwise, it is unspecified whether any class for
which trivial relocation (i.e., the effects oftrivially_relocate ([[obj.lifetime]](obj.lifetime "20.2.6Explicit lifetime management"))) would be semantically equivalent
to move-construction of the destination object followed by destruction of the
source object is a trivially relocatable class ([[class.prop]](class.prop "11.2Properties of classes"))[.](#library.class.props-2.sentence-1)
[3](#library.class.props-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3838)
Unless explicitly stated otherwise, it is unspecified whether a class C is a replaceable class ([[class.prop]](class.prop "11.2Properties of classes")) if assigning an xvalue a of
type C to an object b of type C is semantically
equivalent to destroying b and then constructing from a inb's place[.](#library.class.props-3.sentence-1)
#### [16.4.6.12](#protection.within.classes) Protection within classes [[protection.within.classes]](protection.within.classes)
[1](#protection.within.classes-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3847)
It is unspecified whether any function signature or class described in[[support]](support "17Language support library") through [[exec]](exec "33Execution control library") and [[depr]](depr "Annex D(normative)Compatibility features") is a
friend of another class in the C++ standard library[.](#protection.within.classes-1.sentence-1)
#### [16.4.6.13](#derivation) Derived classes [[derivation]](derivation)
[1](#derivation-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3856)
An implementation may derive any class in the C++ standard library from a class with a
name reserved to the implementation[.](#derivation-1.sentence-1)
[2](#derivation-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3862)
Certain classes defined in the C++ standard library are required to be derived from
other classes
in the C++ standard library[.](#derivation-2.sentence-1)
An implementation may derive such a class directly from the required base or indirectly
through a hierarchy of base classes with names reserved to the implementation[.](#derivation-2.sentence-2)
[3](#derivation-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3870)
In any case:
- [(3.1)](#derivation-3.1)
Every base class described asvirtual shall be virtual;
- [(3.2)](#derivation-3.2)
Every base class not specified asvirtual shall not be virtual;
- [(3.3)](#derivation-3.3)
Unless explicitly stated otherwise, types with distinct names shall be distinct
types[.](#derivation-3.sentence-1)
[*Note [1](#derivation-note-1)*:
There is an implicit exception to this rule for types that are
described as synonyms ([[dcl.typedef]](dcl.typedef "9.2.4The typedef specifier"), [[namespace.udecl]](namespace.udecl "9.10The using declaration")), such assize_t ([[support.types]](support.types "17.2Common definitions")) andstreamoff ([[stream.types]](stream.types "31.2.2Types"))[.](#derivation-3.3.sentence-2)
— *end note*]
[4](#derivation-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3892)
All types specified in the C++ standard library shall be non-final types
unless otherwise specified[.](#derivation-4.sentence-1)
#### [16.4.6.14](#res.on.exception.handling) Restrictions on exception handling [[res.on.exception.handling]](res.on.exception.handling)
[1](#res.on.exception.handling-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3900)
Any of the functions defined in the C++ standard librarycan report a failure by throwing an exception of a type
described in its *Throws*: paragraph,
or of a type derived from a type named in the *Throws*: paragraph
that would be caught by a [*handler*](except.pre#nt:handler "14.1Preamble[except.pre]") ([[except.handle]](except.handle "14.4Handling an exception")) for the base type[.](#res.on.exception.handling-1.sentence-1)
[2](#res.on.exception.handling-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3908)
Functions from the C standard library shall not throw exceptions[156](#footnote-156 "That is, the C standard library functions can all be treated as if they are marked noexcept. This allows implementations to make performance optimizations based on the absence of exceptions at runtime.") except when such a function calls a program-supplied function that throws an
exception[.](#res.on.exception.handling-2.sentence-1)[157](#footnote-157 "The functions qsort() and bsearch() ([alg.c.library]) meet this condition.")
[3](#res.on.exception.handling-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3926)
Destructor operations defined in the C++ standard library
shall not throw exceptions[.](#res.on.exception.handling-3.sentence-1)
Every destructor in the C++ standard library shall behave as if it had a
non-throwing exception specification ([[except.spec]](except.spec "14.5Exception specifications"))[.](#res.on.exception.handling-3.sentence-2)
[4](#res.on.exception.handling-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3932)
Functions defined in the
C++ standard librarythat do not have a *Throws*: paragraph
but do have a potentially-throwing exception specification
may throw implementation-defined exceptions[.](#res.on.exception.handling-4.sentence-1)[158](#footnote-158 "In particular, they can report a failure to allocate storage by throwing an exception of type bad_­alloc, or a class derived from bad_­alloc ([bad.alloc]).")
Implementations should
report errors by throwing exceptions of or derived
from the standard
exception classes ([[bad.alloc]](bad.alloc "17.6.4.1Class bad_­alloc"), [[support.exception]](support.exception "17.9Exception handling"), [[std.exceptions]](std.exceptions "19.2Exception classes"))[.](#res.on.exception.handling-4.sentence-2)
[5](#res.on.exception.handling-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3952)
An implementation may strengthen the
exception specification
for a non-virtual function
by adding a non-throwing exception specification[.](#res.on.exception.handling-5.sentence-1)
[156)](#footnote-156)[156)](#footnoteref-156)
That is, the C standard library functions can all be treated as if they
are marked noexcept[.](#footnote-156.sentence-1)
This allows implementations to make performance optimizations
based on the absence of exceptions at runtime[.](#footnote-156.sentence-2)
[157)](#footnote-157)[157)](#footnoteref-157)
The functionsqsort() andbsearch() ([[alg.c.library]](alg.c.library "26.13C library algorithms")) meet this condition[.](#footnote-157.sentence-1)
[158)](#footnote-158)[158)](#footnoteref-158)
In particular, they
can report a failure to allocate storage by throwing an exception of type[bad_alloc](bad.alloc "17.6.4.1Class bad_­alloc[bad.alloc]"),
or a class derived frombad_alloc ([[bad.alloc]](bad.alloc "17.6.4.1Class bad_­alloc"))[.](#footnote-158.sentence-1)
#### [16.4.6.15](#res.contract.assertions) Contract assertions [[res.contract.assertions]](res.contract.assertions)
[1](#res.contract.assertions-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3960)
Unless specified otherwise,
an implementation may check
the specified preconditions and postconditions of a function
in the C++ standard library using contract
assertions ([[basic.contract]](basic.contract "6.11Contract assertions"), [[structure.specifications]](structure.specifications "16.3.2.4Detailed specifications"))[.](#res.contract.assertions-1.sentence-1)
#### [16.4.6.16](#value.error.codes) Value of error codes [[value.error.codes]](value.error.codes)
[1](#value.error.codes-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3969)
Certain functions in the C++ standard library report errors via aerror_code ([[syserr.errcode.overview]](syserr.errcode.overview "19.5.4.1Overview")) object[.](#value.error.codes-1.sentence-1)
That object'scategory() member shall return system_category() for
errors originating from the operating system, or a reference to animplementation-defined error_category object for errors originating elsewhere[.](#value.error.codes-1.sentence-2)
The implementation shall define the possible values of value() for each of these
error categories[.](#value.error.codes-1.sentence-3)
[*Example [1](#value.error.codes-example-1)*:
For operating systems that are based on POSIX,
implementations should define the std::system_category() values as
identical to the POSIX errno values, with additional values as defined by the
operating system's documentation[.](#value.error.codes-1.sentence-4)
Implementations for operating systems that are not
based on POSIX should define values identical to the operating system's
values[.](#value.error.codes-1.sentence-5)
For errors that do not originate from the operating system, the implementation
may provide enums for the associated values[.](#value.error.codes-1.sentence-6)
— *end example*]
#### [16.4.6.17](#lib.types.movedfrom) Moved-from state of library types [[lib.types.movedfrom]](lib.types.movedfrom)
[1](#lib.types.movedfrom-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3990)
Objects of types defined in the C++ standard library may be moved
from ([[class.copy.ctor]](class.copy.ctor "11.4.5.3Copy/move constructors"))[.](#lib.types.movedfrom-1.sentence-1)
Move operations may be explicitly specified or
implicitly generated[.](#lib.types.movedfrom-1.sentence-2)
Unless otherwise specified, such moved-from objects shall
be placed in a valid but unspecified state ([[defns.valid]](defns.valid "3.67valid but unspecified state"))[.](#lib.types.movedfrom-1.sentence-3)
[2](#lib.types.movedfrom-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L3996)
An object of a type defined in the C++ standard library may be
move-assigned ([[class.copy.assign]](class.copy.assign "11.4.6Copy/move assignment operator")) to itself[.](#lib.types.movedfrom-2.sentence-1)
Unless otherwise specified, such an assignment places the object in
a valid but unspecified state[.](#lib.types.movedfrom-2.sentence-2)