C++ Logo

std-proposals

Advanced search

Re: source_location improvement

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 28 Apr 2021 23:27:13 -0400
Wouldn't a better solution be just allowing compile-time string
processing and non-transient allocations? Then, you could just do
this:

```
void log(char const *msg, my_source_location loc =
make_src_loc(source_location::current()))
{
}
```

Where `my_source_location` is your type generated by a call to the
`consteval` function `make_src_loc`, which takes a source location and
does the string processing that you want.

Received on 2021-04-28 22:27:26