1. 7
  1.  

  2. 2

    __asm__("# test begin"); - this is a fun one, never seen it before. Great for comparing efficiency!

    1. 2

      I’m reminded of a much older technique: the X Macro (and also at Wikipedia).

      1. 1

        Wow, that is a truly sick hack. (In the positive sense!) It would never have occurred to me to (ab)use PRETTY_FUNCTION that way.

        I am totally grabbing that magic_enums library — I’ve been wanting such functionality for ages.

        1. 1

          There are a few limitations for magic_enums but I’ve never hit them in practice. I’m hoping that the Reflection TS will let this kind of thing be done without hacks eventually because it really is a joy to use. Most recently, I’ve used it with a command-line argument parser so I can just expose an enum as a flag type and the argument parser will permit any of the enum values with no additional code and bind that to an enum variable of the correct type that I provide to the argument parser.

          1. 1

            /me shivers with delight