std::formatter for Custom Types with std::format (C++20) - C++ Utilities | Modern Cpp Series Ep. 189

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • ►Full C++ Series Playlist: • The C++ Programming La...
    ►Find full courses on: courses.mshah.io/
    ►Join as Member to Support the channel: / @mikeshah
    ►Lesson Description: In this lesson we take a look at std::format again, but this time for custom types. I will demonstrate how to write a specialization for std::formatter so that you can use std::format to print out your custom types. I'll also show you how to write special cases, so that you can have your own types of special format specifiers for different types of output. As always, feel free to bring up any questions and discuss what you've learned!
    ►RUclips Channel: / mikeshah
    ►Please like and subscribe to help the channel!
    ►Join our free community: courses.mshah....

Комментарии • 11

  • @VoidloniXaarii
    @VoidloniXaarii 2 месяца назад +1

    Always so thankful for your wonderful c++ and gfx lessons! The other languages ones are also intriguing to me but I would like to especially thank you for the modern cpp and cross platform gfx lessons which are the best in the world ❤🙏

    • @MikeShah
      @MikeShah  2 месяца назад +1

      Cheers, thank you for the very kind words!

  • @JRivero
    @JRivero 2 месяца назад +1

    Outstanding

    • @MikeShah
      @MikeShah  2 месяца назад

      @@JRivero cheers!

  • @simonfarre4907
    @simonfarre4907 2 месяца назад +1

    A C++20 feature that still hasn't landed in GCC or Clang. It is painful.

    • @MikeShah
      @MikeShah  2 месяца назад +1

      Features sometimes moving faster than the compilers, and sometimes we get features before standardization as well 🙂

  • @pioneermk2639
    @pioneermk2639 2 месяца назад +1

    write
    using namespace std ;
    before the code and u wont need to write std before any thing like cout and cin

    • @MikeShah
      @MikeShah  2 месяца назад +4

      I like to show the full namespace. For these small examples it does not matter, but at scale it's a good habit to have

    • @bobweiram6321
      @bobweiram6321 2 месяца назад

      Hey Kiddo! Do you seriously think you can teach C++ to professor of computer science with decades of industry experience in C++? Go play Minecraft.