Let's get comfortable with SFINAE (C++)

Ғылым және технология

In this video we get comfortable with an advanced C++ topic: SFINAE
SFINAE stands for Substitution Failure Is Not An Error. It is a C++ template metaprogramming technique that allows us to choose between implementations depending on the "characteristics" of a type.
In other words it's not about what a type is, but what it can do.
It's a very powerful technique that allows us to write generic code that can be used with different types, and it's used extensively in the standard library.
I am planning to write a blog post about it so that you can have the code in a more usable format.
I will do this once I reach 1000 subscribers, so if you liked the video and would like to get hold of the code, please subscribe and share the video with your friends. 🎉
2024 Update: 1000 Subscribers reached!
Here's the tutorial in a written form: platis.solutions/blog/2024/01...
00:00 Introduction, disclaimers and prerequisites
02:31 SFINAE: What and why?
05:54 SFINAE alternatives
09:43 Basic SFINAE without std::enable_if
16:26 std::enable_if
19:31 SFINAE with std::enable_if
23:09 Creating traits
26:30 std::void_t
28:55 Introspection with declval
30:36 SFINAE on class member functions
32:15 Disabling or enabling functions with SFINAE
34:06 SFINAE and fold expressions
34:42 Conclusion and takeaways

Пікірлер: 19

  • @platisd
    @platisd4 ай бұрын

    1000 subscribers reached! Here's the written tutorial: platis.solutions/blog/2024/01/27/lets-get-comfortable-with-sfinae/

  • @hr1100
    @hr110020 күн бұрын

    Thank you for this. I've read several articles and watched cpp con presentations. Your take on the subject was the best i've encountered yet all because you eased us in with the very basic building blocks first.

  • @heartbrave7476
    @heartbrave747621 күн бұрын

    超级棒的视频,深入浅出,娓娓道来,使我明白了很多关于C++的用法。

  • @_noisecode
    @_noisecodeАй бұрын

    Great, approachable, yet in-depth tutorial on an advanced topic. KZread needs more content just like this.

  • @platisd

    @platisd

    Ай бұрын

    Thank you so much for the kind feedback! :}

  • @pawankataria5970
    @pawankataria59702 ай бұрын

    Thanks for this, you made SFINAE easy for the world !

  • @vukasinstrbac3742
    @vukasinstrbac37428 ай бұрын

    A good explanation. A perfect continuation would be achieving the same thing with concepts.

  • @user-fz5pw5kg3w
    @user-fz5pw5kg3w7 ай бұрын

    Thank you! Your examples were excellent, and I came away with a better understanding of SFINAE and alternatives.

  • @UsernameUsername0000
    @UsernameUsername00005 ай бұрын

    Perfect presentation & pace!

  • @lullabydayal1202
    @lullabydayal12028 ай бұрын

    I've listened to Dimitris talk in C++ Athens meetup. This is a brilliant session covering SFINAE; its alternatives and some cool techniques with it (I wouldn't know). I'm planning to revisit this video again for referring some advanced topics discussed whenever I need. I would recommend this video as a great watch to all C++ enthusiasts.

  • @zeez7777
    @zeez77772 ай бұрын

    This is truly an amazing video. Thank you for this presentation.

  • @Chupe_chupe
    @Chupe_chupeАй бұрын

    Great video

  • @eotcoldhymns2930
    @eotcoldhymns29308 ай бұрын

    really great video from scratch

  • @MrCiscoski
    @MrCiscoski8 ай бұрын

    Thanks this was really well presented

  • @gatita_liliana
    @gatita_liliana8 ай бұрын

    ahhhhhhhhhhhhhh great video

  • @pengliu9987
    @pengliu99873 ай бұрын

    Nice and informative video. One suggestion to the terminology of "subclass" at 14:45 (At kzread.info/dash/bejne/X45rp7GQhs7IY7A.html). Things such as typename S::IpV4, S::IpV6 in C++ are called member type, while "subclass" typically means "derived class".

  • @platisd

    @platisd

    3 ай бұрын

    You're correct! I hadn't noticed this until you mentioned it. Another term could be "nested class". 👍

Келесі