0

Looking at C++ Core Guidelines as a new C++ Programmer, and seeing this kind of declaration is very weird to me coming from a C# background.

Example taken here.

void use()
{
    blink_led(2s);
    blink_led(1500ms);
}

Would someone like to explain or give me pointers to understand what's going on?

Thanks!

Blattie
  • 1
  • 1
  • 2
    It's called "User-defined literals" and its been around since C++11, see here: https://en.cppreference.com/w/cpp/language/user_literal – Dai Jul 08 '22 at 04:13
  • Note that user-defined-literals need to start with an underscore, whereas literals in the std namespace don't. https://stackoverflow.com/questions/29017344/user-defined-literals-without-underscore – cigien Jul 08 '22 at 04:21
  • Thanks a lot for the fast reponse I will check this out! – Blattie Jul 08 '22 at 04:27

0 Answers0