From Jason Turner

[support.srcloc.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpu7jac5wn/{from.md → to.md} +61 -0
tmp/tmpu7jac5wn/{from.md → to.md} RENAMED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Creation <a id="support.srcloc.cons">[[support.srcloc.cons]]</a>
2
+
3
+ ``` cpp
4
+ static consteval source_location current() noexcept;
5
+ ```
6
+
7
+ *Returns:*
8
+
9
+ - When invoked by a function call whose *postfix-expression* is a
10
+ (possibly parenthesized) *id-expression* naming `current`, returns a
11
+ `source_location` with an implementation-defined value. The value
12
+ should be affected by `#line` [[cpp.line]] in the same manner as for
13
+ \_\_LINE\_\_ and \_\_FILE\_\_. The values of the exposition-only data
14
+ members of the returned `source_location` object are indicated in
15
+ [[support.srcloc.current]].
16
+ - Otherwise, when invoked in some other way, returns a `source_location`
17
+ whose data members are initialized with valid but unspecified values.
18
+
19
+ *Remarks:* Any call to `current` that appears as a default member
20
+ initializer [[class.mem]], or as a subexpression thereof, should
21
+ correspond to the location of the constructor definition or aggregate
22
+ initialization that uses the default member initializer. Any call to
23
+ `current` that appears as a default argument [[dcl.fct.default]], or as
24
+ a subexpression thereof, should correspond to the location of the
25
+ invocation of the function that uses the default argument [[expr.call]].
26
+
27
+ [*Example 1*:
28
+
29
+ ``` cpp
30
+ struct s {
31
+ source_location member = source_location::current();
32
+ int other_member;
33
+ s(source_location loc = source_location::current())
34
+ : member(loc) // values of member refer to the location of the calling function[dcl.fct.default]
35
+ {}
36
+ s(int blather) : // values of member refer to this location
37
+ other_member(blather)
38
+ {}
39
+ s(double) // values of member refer to this location
40
+ {}
41
+ };
42
+ void f(source_location a = source_location::current()) {
43
+ source_location b = source_location::current(); // values in b refer to this line
44
+ }
45
+
46
+ void g() {
47
+ f(); // f's first argument corresponds to this line of code
48
+
49
+ source_location c = source_location::current();
50
+ f(c); // f's first argument gets the same values as c, above
51
+ }
52
+ ```
53
+
54
+ — *end example*]
55
+
56
+ ``` cpp
57
+ constexpr source_location() noexcept;
58
+ ```
59
+
60
+ The data members are initialized with valid but unspecified values.
61
+