2
2
< h1 > Reflection library</ h1 >
3
3
4
4
< cxx-section id ="reflection.src_loc ">
5
- < h1 > Class source_location</ h1 >
5
+ < h1 > Class < code > source_location</ code > </ h1 >
6
6
7
- < cxx-section id ="reflection.src_loc.intro ">
8
- < h1 > Header < code > <experimental/source_location> </ code > synopsis</ h1 >
7
+ < cxx-section id ="reflection.src_loc.synop ">
8
+ < h1 > Header < code > <experimental/source_location> </ code > synopsis</ h1 >
9
9
10
10
< pre > < code > namespace std {
11
11
namespace experimental {
12
12
inline namespace fundamentals_v2 {
13
13
14
14
struct source_location {
15
+ < cxx-ref insynopsis to ="reflection.src_loc.creation "> </ cxx-ref >
16
+ static constexpr source_location current() noexcept;
17
+
15
18
constexpr source_location() noexcept;
16
19
20
+ < cxx-ref insynopsis to ="reflection.src_loc.fields "> </ cxx-ref >
17
21
constexpr uint_least32_t line() const noexcept;
18
22
constexpr uint_least32_t column() const noexcept;
19
23
constexpr const char* file_name() const noexcept;
20
24
constexpr const char* function_name() const noexcept;
21
-
22
- static constexpr source_location current() noexcept;
23
25
};
24
26
25
27
} // namespace fundamentals_v2
26
28
} // namespace experimental
27
29
} // namespace std</ code > </ pre >
28
30
29
- < p >
30
- < cxx-note > The intent of < code > source_location</ code > is to have a small size and efficient copying.</ cxx-note >
31
- </ p >
32
-
33
- < cxx-function >
34
- < cxx-signature > constexpr source_location() noexcept;</ cxx-signature >
35
-
36
- < cxx-effects > Constructs an object of class < code > source_location</ code > .</ cxx-effects >
37
- < cxx-remarks > The values are implementation-defined.</ cxx-remarks >
38
- </ cxx-function >
39
-
40
- < cxx-function >
41
- < cxx-signature > constexpr uint_least32_t line() const noexcept;</ cxx-signature >
42
-
43
- < cxx-returns > The presumed line number (< cxx-ref in ="cxx " to ="cpp.predefined "> </ cxx-ref > ) represented by this object.</ cxx-returns >
44
- </ cxx-function >
45
-
46
- < cxx-function >
47
- < cxx-signature > constexpr uint_least32_t column() const noexcept;</ cxx-signature >
48
-
49
- < cxx-returns >
50
- An implementation-defined value representing
51
- some offset from the start of the line represented by this object.
52
- </ cxx-returns >
53
- </ cxx-function >
54
-
55
- < cxx-function >
56
- < cxx-signature > constexpr const char* file_name() const noexcept;</ cxx-signature >
57
-
58
- < cxx-returns >
59
- The presumed name of the current source file (< cxx-ref in ="cxx " to ="cpp.predefined "> </ cxx-ref > )
60
- represented by this object as an NTBS.
61
- </ cxx-returns >
62
- </ cxx-function >
63
-
64
- < cxx-function >
65
- < cxx-signature > constexpr const char* function_name() const noexcept;</ cxx-signature >
66
-
67
- < cxx-returns >
68
- If this object represents a position in the body of a function,
69
- returns an implementation-defined NTBS that should correspond to the function name.
70
- Otherwise, returns an empty string.
71
- </ cxx-returns >
72
- </ cxx-function >
73
-
74
- < cxx-function >
75
- < cxx-signature > static constexpr source_location current() noexcept;</ cxx-signature >
76
-
77
- < cxx-returns >
78
- When invoked by a function call (< cxx-ref in ="cxx " to ="expr.call "> </ cxx-ref > )
79
- whose < cxx-grammarterm > postfix-expression</ cxx-grammarterm > is
80
- a (possibly parenthesized) < cxx-grammarterm > id-expression</ cxx-grammarterm > naming < code > current</ code > ,
81
- returns a < code > source_location</ code > with an implementation-defined value.
82
- The value should be affected by < code > #line</ code >
83
- (< cxx-ref in ="cxx " to ="cpp.line "> </ cxx-ref > ) in the same manner as for < code > __LINE__</ code > and < code > __FILE__</ code > .
84
- If invoked in some other way, the value returned is unspecified.
85
- </ cxx-returns >
86
- < cxx-remarks >
87
- When a < cxx-grammarterm > brace-or-equal-initializer</ cxx-grammarterm > is used to initialize a non-static data member,
88
- any calls to < code > current</ code > should correspond to the location of
89
- the constructor or aggregate initialization that initializes the member.
90
- </ cxx-remarks >
91
31
< p >
92
- < cxx-note > When used as a default argument (< cxx-ref in ="cxx " to ="dcl.fct.default "> </ cxx-ref > ),
93
- the value of the < code > source_location</ code > will be the location of the call to < code > current</ code > at the call site.</ cxx-note >
32
+ < cxx-note > The intent of < code > source_location</ code > is to have a small size and efficient copying.</ cxx-note >
94
33
</ p >
95
- < cxx-example >
96
- < pre > < code > struct s {
34
+ </ cxx-section >
35
+
36
+ < cxx-section id ="reflection.src_loc.creation ">
37
+ < h1 > < code > source_location</ code > creation</ h1 >
38
+
39
+ < cxx-function >
40
+ < cxx-signature > static constexpr source_location current() noexcept;</ cxx-signature >
41
+
42
+ < cxx-returns >
43
+ When invoked by a function call (< cxx-ref in ="cxx " to ="expr.call "> </ cxx-ref > )
44
+ whose < cxx-grammarterm > postfix-expression</ cxx-grammarterm > is
45
+ a (possibly parenthesized) < cxx-grammarterm > id-expression</ cxx-grammarterm > naming < code > current</ code > ,
46
+ returns a < code > source_location</ code > with an implementation-defined value.
47
+ The value should be affected by < code > #line</ code >
48
+ (< cxx-ref in ="cxx " to ="cpp.line "> </ cxx-ref > ) in the same manner as for < code > __LINE__</ code > and < code > __FILE__</ code > .
49
+ If invoked in some other way, the value returned is unspecified.
50
+ </ cxx-returns >
51
+ < cxx-remarks >
52
+ When a < cxx-grammarterm > brace-or-equal-initializer</ cxx-grammarterm > is used to initialize a non-static data member,
53
+ any calls to < code > current</ code > should correspond to the location of
54
+ the constructor or aggregate initialization that initializes the member.
55
+ </ cxx-remarks >
56
+ < p >
57
+ < cxx-note > When used as a default argument (< cxx-ref in ="cxx " to ="dcl.fct.default "> </ cxx-ref > ),
58
+ the value of the < code > source_location</ code > will be the location of the call to < code > current</ code > at the call site.</ cxx-note >
59
+ </ p >
60
+ < cxx-example >
61
+ < pre > < code > struct s {
97
62
source_location member = source_location::current();
98
63
int other_member;
99
64
s(source_location loc = source_location::current())
@@ -115,7 +80,53 @@ <h1>Header <code><experimental/source_location></code> synopsis</h1>
115
80
source_location c = source_location::current();
116
81
f(c); // f< i > ’s first argument gets the same values as </ i > c< i > , above</ i >
117
82
}</ code > </ pre >
118
- </ cxx-example >
119
- </ cxx-function >
83
+ </ cxx-example >
84
+ </ cxx-function >
85
+
86
+ < cxx-function >
87
+ < cxx-signature > constexpr source_location() noexcept;</ cxx-signature >
88
+
89
+ < cxx-effects > Constructs an object of class < code > source_location</ code > .</ cxx-effects >
90
+ < cxx-remarks > The values are implementation-defined.</ cxx-remarks >
91
+ </ cxx-function >
92
+ </ cxx-section >
93
+
94
+ < cxx-section id ="reflection.src_loc.fields ">
95
+ < h1 > < code > source_location</ code > field access</ h1 >
96
+
97
+ < cxx-function >
98
+ < cxx-signature > constexpr uint_least32_t line() const noexcept;</ cxx-signature >
99
+
100
+ < cxx-returns > The presumed line number (< cxx-ref in ="cxx " to ="cpp.predefined "> </ cxx-ref > ) represented by this object.</ cxx-returns >
101
+ </ cxx-function >
102
+
103
+ < cxx-function >
104
+ < cxx-signature > constexpr uint_least32_t column() const noexcept;</ cxx-signature >
105
+
106
+ < cxx-returns >
107
+ An implementation-defined value representing
108
+ some offset from the start of the line represented by this object.
109
+ </ cxx-returns >
110
+ </ cxx-function >
111
+
112
+ < cxx-function >
113
+ < cxx-signature > constexpr const char* file_name() const noexcept;</ cxx-signature >
114
+
115
+ < cxx-returns >
116
+ The presumed name of the current source file (< cxx-ref in ="cxx " to ="cpp.predefined "> </ cxx-ref > )
117
+ represented by this object as an NTBS.
118
+ </ cxx-returns >
119
+ </ cxx-function >
120
+
121
+ < cxx-function >
122
+ < cxx-signature > constexpr const char* function_name() const noexcept;</ cxx-signature >
123
+
124
+ < cxx-returns >
125
+ If this object represents a position in the body of a function,
126
+ returns an implementation-defined NTBS that should correspond to the function name.
127
+ Otherwise, returns an empty string.
128
+ </ cxx-returns >
129
+ </ cxx-function >
130
+ </ cxx-section >
120
131
</ cxx-section >
121
132
</ cxx-clause >
0 commit comments