This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,196 @@
[support.srcloc.class]
# 17 Language support library [[support]](./#support)
## 17.8 Source location [[support.srcloc]](support.srcloc#class)
### 17.8.2 Class source_location [support.srcloc.class]
#### [17.8.2.1](#general) General [[support.srcloc.class.general]](support.srcloc.class.general)
[🔗](#lib:source_location)
namespace std {struct source_location {// source location constructionstatic consteval source_location current() noexcept; constexpr source_location() noexcept; // source location field accessconstexpr uint_least32_t line() const noexcept; constexpr uint_least32_t column() const noexcept; constexpr const char* file_name() const noexcept; constexpr const char* function_name() const noexcept; private: uint_least32_t line_; // *exposition only* uint_least32_t column_; // *exposition only*const char* file_name_; // *exposition only*const char* function_name_; // *exposition only*};}
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3658)
The type source_location meets the[*Cpp17DefaultConstructible*](utility.arg.requirements#:Cpp17DefaultConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17CopyConstructible*](utility.arg.requirements#:Cpp17CopyConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17CopyAssignable*](utility.arg.requirements#:Cpp17CopyAssignable "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17Swappable*](swappable.requirements#:Cpp17Swappable "16.4.4.3Swappable requirements[swappable.requirements]"), and[*Cpp17Destructible*](utility.arg.requirements#:Cpp17Destructible "16.4.4.2Template argument requirements[utility.arg.requirements]") requirements ([[utility.arg.requirements]](utility.arg.requirements "16.4.4.2Template argument requirements"), [[swappable.requirements]](swappable.requirements "16.4.4.3Swappable requirements"))[.](#general-1.sentence-1)
All of the following conditions are true:
- [(1.1)](#general-1.1)
is_nothrow_move_constructible_v<source_location>
- [(1.2)](#general-1.2)
is_nothrow_move_assignable_v<source_location>
- [(1.3)](#general-1.3)
is_nothrow_swappable_v<source_location>
[*Note [1](#general-note-1)*:
The intent of source_location is
to have a small size and efficient copying[.](#general-1.sentence-2)
It is unspecified
whether the copy/move constructors and the copy/move assignment operators
are trivial and/or constexpr[.](#general-1.sentence-3)
— *end note*]
[2](#general-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3680)
The data members file_name_ and function_name_ always each refer to an ntbs[.](#general-2.sentence-1)
[3](#general-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3684)
The copy/move constructors and the copy/move assignment operators ofsource_location meet the following postconditions:
Given two objects lhs and rhs of type source_location,
where lhs is a copy/move result of rhs, and
where rhs_p is a value denoting the state of rhs before the corresponding copy/move operation,
then each of the following conditions is true:
- [(3.1)](#general-3.1)
strcmp(lhs.file_name(), rhs_p.file_name()) == 0
- [(3.2)](#general-3.2)
strcmp(lhs.function_name(), rhs_p.function_name()) == 0
- [(3.3)](#general-3.3)
lhs.line() == rhs_p.line()
- [(3.4)](#general-3.4)
lhs.column() == rhs_p.column()
#### [17.8.2.2](#support.srcloc.cons) Creation [[support.srcloc.cons]](support.srcloc.cons)
[🔗](#support.srcloc.cons-itemdecl:1)
`static consteval source_location current() noexcept;
`
[1](#support.srcloc.cons-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3705)
*Returns*:
- [(1.1)](#support.srcloc.cons-1.1)
When invoked by a function call
whose [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") is
a (possibly parenthesized) [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") naming current,
returns a source_location with an implementation-defined value[.](#support.srcloc.cons-1.1.sentence-1)
The value should be affected by #line ([[cpp.line]](cpp.line "15.8Line control"))
in the same manner as for __LINE__ and __FILE__[.](#support.srcloc.cons-1.1.sentence-2)
The values of the exposition-only data members
of the returned source_location object
are indicated in Table [43](#tab:support.srcloc.current "Table 43: Value of object returned by current")[.](#support.srcloc.cons-1.1.sentence-3)
Table [43](#tab:support.srcloc.current) — Value of object returned by current [[tab:support.srcloc.current]](./tab:support.srcloc.current)
| [🔗](#tab:support.srcloc.current-row-1)<br> **Element** | **Value** |
| --- | --- |
| [🔗](#tab:support.srcloc.current-row-2)<br> line_ | A presumed line number ([[cpp.predefined]](cpp.predefined "15.12Predefined macro names"))[.](#tab:support.srcloc.current-row-2-column-2-sentence-1)<br>Line numbers are presumed to be 1-indexed; however, an implementation is encouraged to use 0 when the line number is unknown[.](#tab:support.srcloc.current-row-2-column-2-sentence-2) |
| [🔗](#tab:support.srcloc.current-row-3)<br> column_ | An implementation-defined value denoting some offset from the start of the line denoted by line_[.](#tab:support.srcloc.current-row-3-column-2-sentence-1)<br>Column numbers are presumed to be 1-indexed; however, an implementation is encouraged to use 0 when the column number is unknown[.](#tab:support.srcloc.current-row-3-column-2-sentence-2) |
| [🔗](#tab:support.srcloc.current-row-4)<br> file_name_ | A presumed name of the current source file ([[cpp.predefined]](cpp.predefined "15.12Predefined macro names")) as an ntbs[.](#tab:support.srcloc.current-row-4-column-2-sentence-1) |
| [🔗](#tab:support.srcloc.current-row-5)<br> function_name_ | A name of the current function such as in __func__ ([[dcl.fct.def.general]](dcl.fct.def.general "9.6.1General")) if any, an empty string otherwise[.](#tab:support.srcloc.current-row-5-column-2-sentence-1) |
- [(1.2)](#support.srcloc.cons-1.2)
Otherwise, when invoked in some other way, returns a source_location whose data members are initialized
with valid but unspecified values[.](#support.srcloc.cons-1.2.sentence-1)
[2](#support.srcloc.cons-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3748)
*Remarks*: Any call to current that appears
as a default member initializer ([[class.mem.general]](class.mem.general "11.4.1General")), or
as a subexpression thereof,
should correspond to the location of
the constructor definition or aggregate initialization
that uses the default member initializer[.](#support.srcloc.cons-2.sentence-1)
Any call to current that appears
as a default argument ([[dcl.fct.default]](dcl.fct.default "9.3.4.7Default arguments")), or
as a subexpression thereof,
should correspond to the location of the invocation of the function
that uses the default argument ([[expr.call]](expr.call "7.6.1.3Function call"))[.](#support.srcloc.cons-2.sentence-2)
[3](#support.srcloc.cons-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3763)
[*Example [1](#support.srcloc.cons-example-1)*: struct s { source_location member = source_location::current(); int other_member;
s(source_location loc = source_location::current()): member(loc) // values of member refer to the location of the calling function ([[dcl.fct.default]](dcl.fct.default "9.3.4.7Default arguments")){} s(int blather) : // values of member refer to this location other_member(blather){} s(double) // values of member refer to this location{}};void f(source_location a = source_location::current()) { source_location b = source_location::current(); // values in b refer to this line}void g() { f(); // f's first argument corresponds to this line of code source_location c = source_location::current();
f(c); // f's first argument gets the same values as c, above} — *end example*]
[🔗](#support.srcloc.cons-itemdecl:2)
`constexpr source_location() noexcept;
`
[4](#support.srcloc.cons-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3796)
*Effects*: The data members are initialized with valid but unspecified values[.](#support.srcloc.cons-4.sentence-1)
#### [17.8.2.3](#support.srcloc.obs) Observers [[support.srcloc.obs]](support.srcloc.obs)
[🔗](#support.srcloc.obs-itemdecl:1)
`constexpr uint_least32_t line() const noexcept;
`
[1](#support.srcloc.obs-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3807)
*Returns*: line_[.](#support.srcloc.obs-1.sentence-1)
[🔗](#support.srcloc.obs-itemdecl:2)
`constexpr uint_least32_t column() const noexcept;
`
[2](#support.srcloc.obs-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3816)
*Returns*: column_[.](#support.srcloc.obs-2.sentence-1)
[🔗](#support.srcloc.obs-itemdecl:3)
`constexpr const char* file_name() const noexcept;
`
[3](#support.srcloc.obs-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3825)
*Returns*: file_name_[.](#support.srcloc.obs-3.sentence-1)
[🔗](#support.srcloc.obs-itemdecl:4)
`constexpr const char* function_name() const noexcept;
`
[4](#support.srcloc.obs-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3834)
*Returns*: function_name_[.](#support.srcloc.obs-4.sentence-1)

View File

@@ -0,0 +1,76 @@
[support.srcloc.class.general]
# 17 Language support library [[support]](./#support)
## 17.8 Source location [[support.srcloc]](support.srcloc#class.general)
### 17.8.2 Class source_location [[support.srcloc.class]](support.srcloc.class#general)
#### 17.8.2.1 General [support.srcloc.class.general]
[🔗](#lib:source_location)
namespace std {struct source_location {// source location constructionstatic consteval source_location current() noexcept; constexpr source_location() noexcept; // source location field accessconstexpr uint_least32_t line() const noexcept; constexpr uint_least32_t column() const noexcept; constexpr const char* file_name() const noexcept; constexpr const char* function_name() const noexcept; private: uint_least32_t line_; // *exposition only* uint_least32_t column_; // *exposition only*const char* file_name_; // *exposition only*const char* function_name_; // *exposition only*};}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3658)
The type source_location meets the[*Cpp17DefaultConstructible*](utility.arg.requirements#:Cpp17DefaultConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17CopyConstructible*](utility.arg.requirements#:Cpp17CopyConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17CopyAssignable*](utility.arg.requirements#:Cpp17CopyAssignable "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17Swappable*](swappable.requirements#:Cpp17Swappable "16.4.4.3Swappable requirements[swappable.requirements]"), and[*Cpp17Destructible*](utility.arg.requirements#:Cpp17Destructible "16.4.4.2Template argument requirements[utility.arg.requirements]") requirements ([[utility.arg.requirements]](utility.arg.requirements "16.4.4.2Template argument requirements"), [[swappable.requirements]](swappable.requirements "16.4.4.3Swappable requirements"))[.](#1.sentence-1)
All of the following conditions are true:
- [(1.1)](#1.1)
is_nothrow_move_constructible_v<source_location>
- [(1.2)](#1.2)
is_nothrow_move_assignable_v<source_location>
- [(1.3)](#1.3)
is_nothrow_swappable_v<source_location>
[*Note [1](#note-1)*:
The intent of source_location is
to have a small size and efficient copying[.](#1.sentence-2)
It is unspecified
whether the copy/move constructors and the copy/move assignment operators
are trivial and/or constexpr[.](#1.sentence-3)
— *end note*]
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3680)
The data members file_name_ and function_name_ always each refer to an ntbs[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3684)
The copy/move constructors and the copy/move assignment operators ofsource_location meet the following postconditions:
Given two objects lhs and rhs of type source_location,
where lhs is a copy/move result of rhs, and
where rhs_p is a value denoting the state of rhs before the corresponding copy/move operation,
then each of the following conditions is true:
- [(3.1)](#3.1)
strcmp(lhs.file_name(), rhs_p.file_name()) == 0
- [(3.2)](#3.2)
strcmp(lhs.function_name(), rhs_p.function_name()) == 0
- [(3.3)](#3.3)
lhs.line() == rhs_p.line()
- [(3.4)](#3.4)
lhs.column() == rhs_p.column()

View File

@@ -0,0 +1,81 @@
[support.srcloc.cons]
# 17 Language support library [[support]](./#support)
## 17.8 Source location [[support.srcloc]](support.srcloc#cons)
### 17.8.2 Class source_location [[support.srcloc.class]](support.srcloc.class#support.srcloc.cons)
#### 17.8.2.2 Creation [support.srcloc.cons]
[🔗](#itemdecl:1)
`static consteval source_location current() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3705)
*Returns*:
- [(1.1)](#1.1)
When invoked by a function call
whose [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") is
a (possibly parenthesized) [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") naming current,
returns a source_location with an implementation-defined value[.](#1.1.sentence-1)
The value should be affected by #line ([[cpp.line]](cpp.line "15.8Line control"))
in the same manner as for __LINE__ and __FILE__[.](#1.1.sentence-2)
The values of the exposition-only data members
of the returned source_location object
are indicated in Table [43](#tab:support.srcloc.current "Table 43: Value of object returned by current")[.](#1.1.sentence-3)
Table [43](#tab:support.srcloc.current) — Value of object returned by current [[tab:support.srcloc.current]](./tab:support.srcloc.current)
| [🔗](#tab:support.srcloc.current-row-1)<br> **Element** | **Value** |
| --- | --- |
| [🔗](#tab:support.srcloc.current-row-2)<br> line_ | A presumed line number ([[cpp.predefined]](cpp.predefined "15.12Predefined macro names"))[.](#tab:support.srcloc.current-row-2-column-2-sentence-1)<br>Line numbers are presumed to be 1-indexed; however, an implementation is encouraged to use 0 when the line number is unknown[.](#tab:support.srcloc.current-row-2-column-2-sentence-2) |
| [🔗](#tab:support.srcloc.current-row-3)<br> column_ | An implementation-defined value denoting some offset from the start of the line denoted by line_[.](#tab:support.srcloc.current-row-3-column-2-sentence-1)<br>Column numbers are presumed to be 1-indexed; however, an implementation is encouraged to use 0 when the column number is unknown[.](#tab:support.srcloc.current-row-3-column-2-sentence-2) |
| [🔗](#tab:support.srcloc.current-row-4)<br> file_name_ | A presumed name of the current source file ([[cpp.predefined]](cpp.predefined "15.12Predefined macro names")) as an ntbs[.](#tab:support.srcloc.current-row-4-column-2-sentence-1) |
| [🔗](#tab:support.srcloc.current-row-5)<br> function_name_ | A name of the current function such as in __func__ ([[dcl.fct.def.general]](dcl.fct.def.general "9.6.1General")) if any, an empty string otherwise[.](#tab:support.srcloc.current-row-5-column-2-sentence-1) |
- [(1.2)](#1.2)
Otherwise, when invoked in some other way, returns a source_location whose data members are initialized
with valid but unspecified values[.](#1.2.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3748)
*Remarks*: Any call to current that appears
as a default member initializer ([[class.mem.general]](class.mem.general "11.4.1General")), or
as a subexpression thereof,
should correspond to the location of
the constructor definition or aggregate initialization
that uses the default member initializer[.](#2.sentence-1)
Any call to current that appears
as a default argument ([[dcl.fct.default]](dcl.fct.default "9.3.4.7Default arguments")), or
as a subexpression thereof,
should correspond to the location of the invocation of the function
that uses the default argument ([[expr.call]](expr.call "7.6.1.3Function call"))[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3763)
[*Example [1](#example-1)*: struct s { source_location member = source_location::current(); int other_member;
s(source_location loc = source_location::current()): member(loc) // values of member refer to the location of the calling function ([[dcl.fct.default]](dcl.fct.default "9.3.4.7Default arguments")){} s(int blather) : // values of member refer to this location other_member(blather){} s(double) // values of member refer to this location{}};void f(source_location a = source_location::current()) { source_location b = source_location::current(); // values in b refer to this line}void g() { f(); // f's first argument corresponds to this line of code source_location c = source_location::current();
f(c); // f's first argument gets the same values as c, above} — *end example*]
[🔗](#itemdecl:2)
`constexpr source_location() noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3796)
*Effects*: The data members are initialized with valid but unspecified values[.](#4.sentence-1)

View File

@@ -0,0 +1,53 @@
[support.srcloc.obs]
# 17 Language support library [[support]](./#support)
## 17.8 Source location [[support.srcloc]](support.srcloc#obs)
### 17.8.2 Class source_location [[support.srcloc.class]](support.srcloc.class#support.srcloc.obs)
#### 17.8.2.3 Observers [support.srcloc.obs]
[🔗](#itemdecl:1)
`constexpr uint_least32_t line() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3807)
*Returns*: line_[.](#1.sentence-1)
[🔗](#itemdecl:2)
`constexpr uint_least32_t column() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3816)
*Returns*: column_[.](#2.sentence-1)
[🔗](#itemdecl:3)
`constexpr const char* file_name() const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3825)
*Returns*: file_name_[.](#3.sentence-1)
[🔗](#itemdecl:4)
`constexpr const char* function_name() const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3834)
*Returns*: function_name_[.](#4.sentence-1)