Subject: Re: [std-proposals] source_location improvement
From: Mike (mike_at_[hidden])
Date: 2021-05-05 16:05:53
That does sound good.
How do we "allow compile-time string processing"?
So, taking my specific problem, given `loc` returned by
source_location::current(), how do we use loc.file_name() (returning
constexpr const char*) and loc.line() (returning constexpr
unint_least32_t) to create a single compile time string like
"foo.cpp(555): beyond all recognition"?Â Could you give me an example of
the kind of syntax you were thinking of?
Are there already proposals for this kind of compile time string
composition from constexpr expressions?
On 29/04/2021 04:27, Jason McKesson via Std-Proposals wrote:
> Wouldn't a better solution be just allowing compile-time string
> processing and non-transient allocations? Then, you could just do
> void log(char const *msg, my_source_location loc =
> 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.
STD-PROPOSALS list run by firstname.lastname@example.org
Standard Proposals Archives on Google Groups