C++ Insights - Episode 51: The magic of C++20s std::source_location

Поділитися
Вставка

КОМЕНТАРІ • 9

  • @almondengine
    @almondengine 18 днів тому

    I didn't know that trick or tool, now I do thank you!

  • @zeez7777
    @zeez7777 6 місяців тому +1

    NIce

  • @garyp.7501
    @garyp.7501 5 місяців тому

    Of course now I want to use a Macro to fill in the boiler plate code.
    #define LogMyError(x) LogError(std::operator""sv(x, 11UL), std::source_location::current(__buildin_source_location()))
    LogMyError("Just a test);

    • @andreas_fertig
      @andreas_fertig  5 місяців тому

      Sarcasm?
      I don't get why you would want to use a macro and why use __builtin_source_location() in ::current. The compiler does that for you already.

    • @garyp.7501
      @garyp.7501 5 місяців тому

      @@andreas_fertig Then I was confused at 4:50 or so where you used it. The define is to avoid the extra typing or copy/pasting of lines 14, 15 of the same code in your right side window.

    • @nielsdegroot9138
      @nielsdegroot9138 2 місяці тому

      @@garyp.7501 You don't need to do that. The right side shows what the compiler makes of it behind the scenes.

  • @anjumlatif3052
    @anjumlatif3052 5 місяців тому +1

    Video voice quality is not good.