From 521b52fb52bb2a4a3115f2511e7a740d83e0e123 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Sep 2020 11:43:10 +0200 Subject: [PATCH] [definitions] Integrate into [intro.defs] Partially addresses ISO/CS 016 (C++20 DIS) --- source/intro.tex | 314 ++++++++++++++++++++++++++++++++++++++++++- source/lib-intro.tex | 311 +----------------------------------------- source/xrefdelta.tex | 1 + 3 files changed, 313 insertions(+), 313 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index 21e7a2580f..e2d9b1ad14 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -115,11 +115,6 @@ \item IEC Electropedia: available at \url{http://www.electropedia.org/} \end{itemize} -\pnum -\ref{definitions} -defines additional terms that are used only in \ref{library} -through \ref{\lastlibchapter} and \ref{depr}. - \pnum Terms that are used only in a small portion of this document are defined where they are used and italicized where they are @@ -141,6 +136,16 @@ although they may involve accesses of scalar subobjects. \end{defnote} +\definition{arbitrary-positional stream}{defns.arbitrary.stream} +\defncontext{library} +\indexdefn{stream!arbitrary-positional}% +stream (described in \ref{input.output}) that can seek to any integral position within +the length of the stream + +\begin{defnote} +Every arbitrary-positional stream is also a repositional stream. +\end{defnote} + \indexdefn{argument}% \indexdefn{argument!function call expression} \definition{argument}{defns.argument} @@ -179,6 +184,63 @@ \defncontext{statement} compound statement\iref{stmt.block} +\definition{character}{defns.character} +\indexdefn{character}% +\defncontext{library} +object which, +when treated sequentially, +can represent text + +\begin{defnote} +The term does not mean only +\tcode{char}, +\tcode{char8_t}, +\tcode{char16_t}, +\tcode{char32_t}, +and +\tcode{wchar_t} +objects, +but any value that can be represented by a type +that provides the definitions specified in +\ref{strings}, \ref{localization}, \ref{input.output}, or~\ref{re}. +\end{defnote} + +\definition{character container type}{defns.character.container} +\defncontext{library} +\indexdefn{type!character container}% +class or a type used to +represent a character + +\begin{defnote} +It is used for one of the template parameters of the string, +iostream, and regular expression class templates. +\end{defnote} + +\definition{comparison function}{defns.comparison} +\defncontext{library} +\indexdefn{function!comparison}% +operator function\iref{over.oper} for any of the +equality\iref{expr.eq}, +relational\iref{expr.rel}, or +three-way comparison\iref{expr.spaceship} +operators + +\definition{component}{defns.component} +\defncontext{library} +\indexdefn{component}% +group of library entities directly related as members, parameters, or +return types + +\begin{defnote} +For example, the class template +\tcode{basic_string} +and the non-member +function templates +that operate on +strings are referred to as the +\term{string component}. +\end{defnote} + \indexdefn{behavior!conditionally-supported}% \definition{conditionally-supported}{defns.cond.supp} program construct that an implementation is not required to support @@ -188,11 +250,36 @@ constructs that it does not support. \end{defnote} +\definition{constant subexpression}{defns.const.subexpr} +\indexdefn{constant subexpression}% +expression whose evaluation as subexpression of a +\grammarterm{conditional-expression} +\tcode{CE}\iref{expr.cond} would not prevent \tcode{CE} +from being a core constant expression\iref{expr.const} + +\definition{deadlock}{defns.deadlock} +\defncontext{library} +\indexdefn{deadlock}% +situation wherein +one or more threads are unable to continue execution because each is +blocked waiting for one or more of the others to satisfy some condition + +\definition{default behavior}{defns.default.behavior.impl} +\indexdefn{behavior!default}% +\defncontext{library implementation} +specific behavior provided by the implementation, +within the scope of the required behavior + \indexdefn{message!diagnostic}% \definition{diagnostic message}{defns.diagnostic} message belonging to an \impldef{diagnostic message} subset of the implementation's output messages +\definition{direct-non-list-initialization}{defns.direct-non-list-init} +\indexdefn{direct-non-list-initialization}% +direct-initialization\iref{dcl.init} +that is not list-initialization\iref{dcl.init.list} + \indexdefn{type!dynamic}% \definition{dynamic type}{defns.dynamic.type} \defncontext{glvalue} type of the most derived object\iref{intro.object} to which the @@ -210,6 +297,40 @@ \definition{dynamic type}{defns.dynamic.type.prvalue} \defncontext{prvalue} static type of the prvalue expression +\definition{expression-equivalent}{defns.expression-equivalent} +\defncontext{library} +\indexdefn{expression-equivalent}% +expressions that all have the same effects, +either +are all potentially-throwing\iref{except.spec} or +are all not potentially-throwing, +and +either +are all constant subexpressions or +are all not constant subexpressions + +\begin{example} +For a value \tcode{x} of type \tcode{int} +and a function \tcode{f} that accepts integer arguments, +the expressions +\tcode{f(x + 2)}, +\tcode{f(2 + x)}, +and +\tcode{f(1 + x + 1)} +are expression-equivalent. +\end{example} + +\definition{handler function}{defns.handler} +\defncontext{library} +\indexdefn{function!handler}% +non-reserved function whose definition may be provided by a \Cpp{} program + +\begin{defnote} +A \Cpp{} program may designate a handler function at various points in its execution by +supplying a pointer to the function when calling any of the library functions that install +handler functions\iref{support}. +\end{defnote} + \indexdefn{program!ill-formed}% \definition{ill-formed program}{defns.ill.formed} program that is not well-formed\iref{defns.well.formed} @@ -219,15 +340,56 @@ behavior, for a well-formed program construct and correct data, that depends on the implementation and that each implementation documents +\definition{implementation-defined strict total order over pointers} +{defns.order.ptr} +\indexdefn{pointer!strict total order}% +\defncontext{library} +\impldef{strict total order over pointer values} +strict total ordering over all pointer values +such that the ordering is consistent with the partial order +imposed by the builtin operators +\tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}, and \tcode{<=>} + \indexdefn{limits!implementation}% \definition{implementation limits}{defns.impl.limits} restrictions imposed upon programs by the implementation +\definition{iostream class templates}{defns.iostream.templates} +\defncontext{library} +templates, defined in \ref{input.output}, +that take two template arguments + +\begin{defnote} +The arguments are named \tcode{charT} and \tcode{traits}. +The argument \tcode{charT} is a character container class, and +the argument \tcode{traits} is a class +which defines additional characteristics and functions +of the character type represented by \tcode{charT} +necessary to implement the iostream class templates. +\end{defnote} + \indexdefn{behavior!locale-specific}% \definition{locale-specific behavior}{defns.locale.specific} behavior that depends on local conventions of nationality, culture, and language that each implementation documents +\definition{modifier function}{defns.modifier} +\defncontext{library} +\indexdefn{function!modifier}% +class member function\iref{class.mfct} other than a constructor, +assignment operator, or destructor +that alters the state of an object of the class + +\definition{move assignment}{defns.move.assign} +\defncontext{library} +\indexdefn{assignment!move}% +assignment of an rvalue of some object type to a modifiable lvalue of the same type + +\definition{move construction}{defns.move.constr} +\defncontext{library} +\indexdefn{construction!move}% +direct-initialization of an object of some type with an rvalue of the same type + \indexdefn{character!multibyte}% \definition{multibyte character}{defns.multibyte} sequence of one or more bytes representing a member of the extended @@ -238,6 +400,28 @@ set\iref{lex.charset}. \end{defnote} +\definition{NTCTS}{defns.ntcts} +\defncontext{library} +\indexdefn{NTCTS}% +\indexdefn{string!null-terminated character type}% +sequence of values that have +character type +that precede the terminating null character type +value +\tcode{charT()} + +\definition{observer function}{defns.observer} +\defncontext{library} +\indexdefn{function!observer}% +class member function\iref{class.mfct} that accesses the state of an object of the class +but does not alter that state + +\begin{defnote} +Observer functions are specified as +\tcode{const} +member functions\iref{class.this}. +\end{defnote} + \indexdefn{parameter}% \indexdefn{parameter!function}% \indexdefn{parameter!catch clause}% @@ -258,6 +442,96 @@ \definition{parameter}{defns.parameter.templ} \defncontext{template} member of a \grammarterm{template-parameter-list} +\definition{program-defined specialization}{defns.prog.def.spec} +\defncontext{library} +\indexdefn{specialization!program-defined}% +explicit template specialization or partial specialization +that is not part of the \Cpp{} standard library and +not defined by the implementation + +\definition{program-defined type}{defns.prog.def.type} +\defncontext{library} +\indexdefn{type!program-defined}% +non-closure class type or enumeration type +that is not part of the \Cpp{} standard library and +not defined by the implementation, +or a closure type of a non-implementation-provided lambda expression, +or an instantiation of a program-defined specialization + +\begin{defnote} +Types defined by the implementation include +extensions\iref{intro.compliance} and internal types used by the library. +\end{defnote} + +\definition{projection}{defns.projection} +\indexdefn{projection}% +\defncontext{function object argument} transformation that +an algorithm applies before inspecting the values of elements + +\begin{example} +\begin{codeblock} +std::pair pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}}; +std::ranges::sort(pairs, std::ranges::less{}, [](auto const& p) { return p.first; }); +\end{codeblock} +sorts the pairs in increasing order of their \tcode{first} members: +\begin{codeblock} +{{0, "baz"}, {1, "bar"}, {2, "foo"}} +\end{codeblock} +\end{example} + +\definition{referenceable type}{defns.referenceable} +\indexdefn{type!referenceable}% +type that is either an +object type, a function type that does not have cv-qualifiers or a +\grammarterm{ref-qualifier}, or a reference type + +\begin{defnote} +The term describes a type to which a reference can be created, +including reference types. +\end{defnote} + +\definition{replacement function}{defns.replacement} +\defncontext{library} +\indexdefn{function!replacement}% +non-reserved function +whose definition is provided by a \Cpp{} program + +\begin{defnote} +Only one definition for such a function is in effect for the duration of the program's +execution, as the result of creating the program\iref{lex.phases} and resolving the +definitions of all translation units\iref{basic.link}. +\end{defnote} + +\definition{repositional stream}{defns.repositional.stream} +\defncontext{library} +\indexdefn{stream!repositional}% +stream (described in \ref{input.output}) that can seek to a position that was +previously encountered + +\definition{required behavior}{defns.required.behavior} +\defncontext{library} +\indexdefn{behavior!required}% +description of replacement function and handler function semantics +applicable to both the behavior provided by the implementation and +the behavior of any such function definition in the program + +\begin{defnote} +If such a function defined in a \Cpp{} program fails to meet the required +behavior when it executes, the behavior is undefined.% +\indextext{undefined} +\end{defnote} + +\definition{reserved function}{defns.reserved.function} +\defncontext{library} +\indexdefn{function!reserved}% +function, specified as part of the \Cpp{} standard library, that is defined by the +implementation + +\begin{defnote} +If a \Cpp{} program provides a definition for any reserved function, the results are undefined.% +\indextext{undefined} +\end{defnote} + \indexdefn{signature}% \definition{signature}{defns.signature} \defncontext{function} @@ -335,6 +609,17 @@ \defncontext{class member function template specialization} signature of the member function template of which it is a specialization and its template arguments (whether explicitly specified or deduced) +\definition{stable algorithm}{defns.stable} +\defncontext{library} +\indexdefn{algorithm!stable}% +\indexdefn{stable algorithm}% +algorithm that preserves, as appropriate to the particular algorithm, the order +of elements + +\begin{defnote} +Requirements for stable algorithms are given in \ref{algorithm.stable}. +\end{defnote} + \indexdefn{type!static}% \definition{static type}{defns.static.type} type of an expression\iref{basic.types} resulting from @@ -346,6 +631,12 @@ executing. \end{defnote} +\definition{traits class}{defns.traits} +\defncontext{library} +\indexdefn{traits}% +class that encapsulates a set of types and functions necessary for class templates and +function templates to manipulate objects of types for which they are instantiated + \indexdefn{unblock}% \definition{unblock}{defns.unblock} satisfy a condition that one or more blocked threads of execution are waiting for @@ -381,6 +672,19 @@ possible behaviors is usually delineated by this document. \end{defnote} +\definition{valid but unspecified state}{defns.valid} +\defncontext{library} +\indexdefn{valid but unspecified state}% +value of an object that is not specified except that the object's invariants are +met and operations on the object behave as specified for its type + +\begin{example} +If an object \tcode{x} of type \tcode{std::vector} is in a +valid but unspecified state, \tcode{x.empty()} can be called unconditionally, +and \tcode{x.front()} can be called only if \tcode{x.empty()} returns +\tcode{false}. +\end{example} + \indexdefn{program!well-formed}% \definition{well-formed program}{defns.well.formed} \Cpp{} program constructed according to the syntax rules, diagnosable diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 9927a9eb70..cce25a2bea 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -10,8 +10,8 @@ how a conforming implementation may provide the entities in the library. \pnum -The following subclauses describe the definitions\iref{definitions}, method of -description\iref{description}, and organization\iref{organization} of the +The following subclauses describe the method of +description\iref{description} and organization\iref{organization} of the library. \ref{requirements}, \ref{\firstlibchapter} through \ref{\lastlibchapter}, and \ref{depr} specify the contents of the library, as well as library requirements and constraints on both well-formed @@ -132,311 +132,6 @@ ISO C \tcode{restrict} qualifier) are the same unless otherwise stated. -\rSec1[definitions]{Definitions} - -\pnum -\begin{note} -\ref{intro.defs} defines additional terms used elsewhere in this document. -\end{note} - -\definition{arbitrary-positional stream}{defns.arbitrary.stream} -\indexdefn{stream!arbitrary-positional}% -stream (described in \ref{input.output}) that can seek to any integral position within -the length of the stream - -\begin{defnote} -Every arbitrary-positional stream is also a repositional stream. -\end{defnote} - -\definition{character}{defns.character} -\indexdefn{character}% -\defncontext{\ref{strings}, \ref{localization}, \ref{input.output}, and~\ref{re}} -object which, -when treated sequentially, -can represent text - -\begin{defnote} -The term does not mean only -\tcode{char}, -\tcode{char8_t}, -\tcode{char16_t}, -\tcode{char32_t}, -and -\tcode{wchar_t} -objects, -but any value that can be represented by a type -that provides the definitions specified in these Clauses. -\end{defnote} - -\definition{character container type}{defns.character.container} -\indexdefn{type!character container}% -class or a type used to -represent a character - -\begin{defnote} -It is used for one of the template parameters of the string, -iostream, and regular expression class templates. -\end{defnote} - -\definition{comparison function}{defns.comparison} -\indexdefn{function!comparison}% -operator function\iref{over.oper} for any of the -equality\iref{expr.eq}, -relational\iref{expr.rel}, or -three-way comparison\iref{expr.spaceship} -operators - -\definition{component}{defns.component} -\indexdefn{component}% -group of library entities directly related as members, parameters, or -return types - -\begin{defnote} -For example, the class template -\tcode{basic_string} -and the non-member -function templates -that operate on -strings are referred to as the -\term{string component}. -\end{defnote} - -\definition{constant subexpression}{defns.const.subexpr} -\indexdefn{constant subexpression}% -expression whose evaluation as subexpression of a -\grammarterm{conditional-expression} -\tcode{CE}\iref{expr.cond} would not prevent \tcode{CE} -from being a core constant expression\iref{expr.const} - -\definition{deadlock}{defns.deadlock} -\indexdefn{deadlock}% -situation wherein -one or more threads are unable to continue execution because each is -blocked waiting for one or more of the others to satisfy some condition - -\definition{default behavior}{defns.default.behavior.impl} -\indexdefn{behavior!default}% -\defncontext{implementation} -specific behavior provided by the implementation, -within the scope of the required behavior - -\definition{default behavior}{defns.default.behavior.func} -\indexdefn{behavior!default}% -\defncontext{specification} -description of replacement function and handler function -semantics - -\definition{direct-non-list-initialization}{defns.direct-non-list-init} -\indexdefn{direct-non-list-initialization}% -direct-initialization\iref{dcl.init} -that is not list-initialization\iref{dcl.init.list} - -\definition{expression-equivalent}{defns.expression-equivalent} -\indexdefn{expression-equivalent}% -expressions that all have the same effects, -either -are all potentially-throwing\iref{except.spec} or -are all not potentially-throwing, -and -either -are all constant subexpressions or -are all not constant subexpressions - -\begin{example} -For a value \tcode{x} of type \tcode{int} -and a function \tcode{f} that accepts integer arguments, -the expressions -\tcode{f(x + 2)}, -\tcode{f(2 + x)}, -and -\tcode{f(1 + x + 1)} -are expression-equivalent. -\end{example} - -\definition{handler function}{defns.handler} -\indexdefn{function!handler}% -non-reserved function whose definition may be provided by a \Cpp{} program - -\begin{defnote} -A \Cpp{} program may designate a handler function at various points in its execution by -supplying a pointer to the function when calling any of the library functions that install -handler functions\iref{support}. -\end{defnote} - -\definition{implementation-defined strict total order over pointers} -{defns.order.ptr} -\indexdefn{pointer!strict total order}% -\impldef{strict total order over pointer values} -strict total ordering over all pointer values -such that the ordering is consistent with the partial order -imposed by the builtin operators -\tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}, and \tcode{<=>} - -\definition{iostream class templates}{defns.iostream.templates} -templates, defined in \ref{input.output}, -that take two template arguments - -\begin{defnote} -The arguments are named -\tcode{charT} -and -\tcode{traits}. -The argument -\tcode{charT} -is a character container class, -and the argument -\tcode{traits} -is a class which defines additional characteristics and functions -of the character type represented by -\tcode{charT} -necessary to implement the iostream class templates. -\end{defnote} - -\definition{modifier function}{defns.modifier} -\indexdefn{function!modifier}% -class member function\iref{class.mfct} other than a constructor, -assignment operator, or destructor -that alters the state of an object of the class - -\definition{move assignment}{defns.move.assign} -\indexdefn{assignment!move}% -assignment of an rvalue of some object type to a modifiable lvalue of the same type - -\definition{move construction}{defns.move.constr} -\indexdefn{construction!move}% -direct-initialization of an object of some type with an rvalue of the same type - -\definition{NTCTS}{defns.ntcts} -\indexdefn{NTCTS}% -\indexdefn{string!null-terminated character type}% -sequence of values that have -character type -that precede the terminating null character type -value -\tcode{charT()} - -\definition{observer function}{defns.observer} -\indexdefn{function!observer}% -class member function\iref{class.mfct} that accesses the state of an object of the class -but does not alter that state - -\begin{defnote} -Observer functions are specified as -\tcode{const} -member functions\iref{class.this}. -\end{defnote} - -\definition{program-defined specialization}{defns.prog.def.spec} -\indexdefn{specialization!program-defined}% -explicit template specialization or partial specialization -that is not part of the \Cpp{} standard library and -not defined by the implementation - -\definition{program-defined type}{defns.prog.def.type} -\indexdefn{type!program-defined}% -non-closure class type or enumeration type -that is not part of the \Cpp{} standard library and -not defined by the implementation, -or a closure type of a non-implementation-provided lambda expression, -or an instantiation of a program-defined specialization - -\begin{defnote} -Types defined by the implementation include -extensions\iref{intro.compliance} and internal types used by the library. -\end{defnote} - -\definition{projection}{defns.projection} -\indexdefn{projection}% -\defncontext{function object argument} transformation that -an algorithm applies before inspecting the values of elements - -\begin{example} -\begin{codeblock} -std::pair pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}}; -std::ranges::sort(pairs, std::ranges::less{}, [](auto const& p) { return p.first; }); -\end{codeblock} -sorts the pairs in increasing order of their \tcode{first} members: -\begin{codeblock} -{{0, "baz"}, {1, "bar"}, {2, "foo"}} -\end{codeblock} -\end{example} - -\definition{referenceable type}{defns.referenceable} -\indexdefn{type!referenceable}% -type that is either an -object type, a function type that does not have cv-qualifiers or a -\grammarterm{ref-qualifier}, or a reference type - -\begin{defnote} -The term describes a type to which a reference can be created, -including reference types. -\end{defnote} - -\definition{replacement function}{defns.replacement} -\indexdefn{function!replacement}% -non-reserved function -whose definition is provided by a \Cpp{} program - -\begin{defnote} -Only one definition for such a function is in effect for the duration of the program's -execution, as the result of creating the program\iref{lex.phases} and resolving the -definitions of all translation units\iref{basic.link}. -\end{defnote} - -\definition{repositional stream}{defns.repositional.stream} -\indexdefn{stream!repositional}% -stream (described in \ref{input.output}) that can seek to a position that was -previously encountered - -\definition{required behavior}{defns.required.behavior} -\indexdefn{behavior!required}% -description of replacement function and handler function semantics -applicable to both the behavior provided by the implementation and -the behavior of any such function definition in the program - -\begin{defnote} -If such a function defined in a \Cpp{} program fails to meet the required -behavior when it executes, the behavior is undefined.% -\indextext{undefined} -\end{defnote} - -\definition{reserved function}{defns.reserved.function} -\indexdefn{function!reserved}% -function, specified as part of the \Cpp{} standard library, that is defined by the -implementation - -\begin{defnote} -If a \Cpp{} program provides a definition for any reserved function, the results are undefined.% -\indextext{undefined} -\end{defnote} - -\definition{stable algorithm}{defns.stable} -\indexdefn{algorithm!stable}% -\indexdefn{stable algorithm}% -algorithm that preserves, as appropriate to the particular algorithm, the order -of elements - -\begin{defnote} -Requirements for stable algorithms are given in \ref{algorithm.stable}. -\end{defnote} - -\definition{traits class}{defns.traits} -\indexdefn{traits}% -class that encapsulates a set of types and functions necessary for class templates and -function templates to manipulate objects of types for which they are instantiated - -\definition{valid but unspecified state}{defns.valid} -\indexdefn{valid but unspecified state}% -value of an object that is not specified except that the object's invariants are -met and operations on the object behave as specified for its type - -\begin{example} -If an object \tcode{x} of type \tcode{std::vector} is in a -valid but unspecified state, \tcode{x.empty()} can be called unconditionally, -and \tcode{x.front()} can be called only if \tcode{x.empty()} returns -\tcode{false}. -\end{example} - \rSec1[description]{Method of description} \rSec2[description.general]{General} @@ -2789,7 +2484,7 @@ Under some circumstances, \indextext{library!\Cpp{} standard}% however, certain of these function descriptions also apply to replacement functions defined -in the program\iref{definitions}. +in the program. \pnum A \Cpp{} program may provide the definition for any of the following diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index e90b5de90d..a2373dbed5 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -27,6 +27,7 @@ % Dissolved subclause \movedxref{intro.ack}{intro.refs} +\movedxref{definitions}{intro.defs} % Deprecated features. %\deprxref{old.label} (if moved to depr.old.label, otherwise use \movedxref)