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.
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.
in constructor template is necessary because: if you don't give the default type, there is no way for you to construct the this type's object. For example, ContidionalCtor x; The compiler will compile the ConditionalCtor struct without any issue but it doesn't know which constructor to use --- you didn't give the parameter type to its constructor template... There is no way to tell compiler the type parameter of constructor before you call it. The best way is use U = T which gives the default parameter type, so ConditionalCtor x will let compiler know the type parameter of constructor ---- default to be int. But if the constructor template has U as its parameter type then you don't have to worry anything. ConditionalCtor x("hello") will let compiler to compile ConditionalCtor::ctor ... Anyway, if the constructor template does't has U as its parameter type, there is no way (as I know) to successfully compile ConditionalCtor x without claim the default type parameter.
Nice and informative video. One suggestion to the terminology of "subclass" at 14:45 (At ruclips.net/video/-Z7EOWVkb3M/видео.html). Things such as typename S::IpV4, S::IpV6 in C++ are called member type, while "subclass" typically means "derived class".
1000 subscribers reached!
Here's the written tutorial: platis.solutions/blog/2024/01/27/lets-get-comfortable-with-sfinae/
Great, approachable, yet in-depth tutorial on an advanced topic. RUclips needs more content just like this.
Thank you so much for the kind feedback! :}
Great video, thanks a lot!
Thanks for this, you made SFINAE easy for the world !
超级棒的视频,深入浅出,娓娓道来,使我明白了很多关于C++的用法。
A good explanation. A perfect continuation would be achieving the same thing with concepts.
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.
This is truly an amazing video. Thank you for this presentation.
Thank you! Your examples were excellent, and I came away with a better understanding of SFINAE and alternatives.
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.
Perfect presentation & pace!
really great video from scratch
Great video
Thanks this was really well presented
SFINAE was like extreme engineering: trying to build a wooden skyscrapper. now `concepts` is the steel invented to safe it.
Nice metaphor.
I have some good material on concepts so I wonder if I should make a C++20 follow up on SFINAE 😁
A better metaphor would be: sfinae is dead, thank god
in constructor template is necessary because: if you don't give the default type, there is no way for you to construct the this type's object. For example, ContidionalCtor x; The compiler will compile the ConditionalCtor struct without any issue but it doesn't know which constructor to use --- you didn't give the parameter type to its constructor template... There is no way to tell compiler the type parameter of constructor before you call it. The best way is use U = T which gives the default parameter type, so ConditionalCtor x will let compiler know the type parameter of constructor ---- default to be int.
But if the constructor template has U as its parameter type then you don't have to worry anything. ConditionalCtor x("hello") will let compiler to compile ConditionalCtor::ctor ...
Anyway, if the constructor template does't has U as its parameter type, there is no way (as I know) to successfully compile ConditionalCtor x without claim the default type parameter.
ahhhhhhhhhhhhhh great video
Xiexie, this helps a lot.
Nice and informative video. One suggestion to the terminology of "subclass" at 14:45 (At ruclips.net/video/-Z7EOWVkb3M/видео.html). Things such as typename S::IpV4, S::IpV6 in C++ are called member type, while "subclass" typically means "derived class".
You're correct! I hadn't noticed this until you mentioned it. Another term could be "nested class". 👍