4 ms·
Thanks! Is there a way to extract the undecorated (?) function name? ("main" in this case, without the return type or args) Maybe a helper class or formatter?
by Tempest1981 3y ago
Thanks!
Is there a way to extract the undecorated (?) function name? ("main" in this case, without the return type or args)
Maybe a helper class or formatter?
- dkersten 3y agoThe actual name format is implementation defined. Here's the output from clang 17: int main():9 auto main()::(anonymous class)::operator()(std::source_location) const:5 so your formatter/helper would need to be compiler-aware, although to extract “main” in both cases I suppose you can just grab everything between the first whitespace and (, although I assume both types would contain specifiers like const where included in the return type. I don’t know what MSVC outputs.
- Tempest1981 3y agoThanks again, I'll have to give it a try once we get on C++20