[Development] C++20 goodies (was: Using '#pragma once' instead of include guards?)
Thiago Macieira
thiago.macieira at intel.com
Thu Oct 13 18:35:18 CEST 2022
On Wednesday, 12 October 2022 02:04:06 PDT Edward Welbourne via Development
wrote:
> Henry Skoglund (11 October 2022 22:18) wrote:
> > Sometime in the far future when Qt requires c++20 things might
> > improve: we could use std::source_location::filename
> > (https://en.cppreference.com/w/cpp/utility/source_location/file_name )
>
> Nice. I'm a bit surprised file_name() returns a char* rather than a
> std::filesystem::path, but it'll do. It's also nice to see
> source_location has a function_name() that can finally unify the
> disparate ways of getting that information.
That's because of what I said: the standard can't agree on what a file is
during compilation. The compiler need not be running on a C++ hosted system,
or on a system that has a file system in the first place, so use of
std::filesystem to represent source code is technically "wrong".
> More things to look forward to when we eventually get to C++20 ...
For me, the one I'm most looking for is also one of the simplest: std::span.
In this PR to another project, you can see my removing of its replacement:
https://github.com/opendcdiag/opendcdiag/pull/165/commits
--
Thiago Macieira - thiago.macieira (AT) intel.com
Cloud Software Architect - Intel DCAI Cloud Engineering
More information about the Development
mailing list