Hacker News new | ask | show | jobs
by dgellow 2432 days ago
If you don’t know what SFINAE is (the article uses the acronym a lot but doesn’t define it):

> Substitution failure is not an error (SFINAE) refers to a situation in C++ where an invalid substitution of template parameters is not in itself an error.

https://en.m.wikipedia.org/wiki/Substitution_failure_is_not_...

1 comments

This is a intermediate-level technique that's quite commonly used. Take a look at <type_traits> to find out what you can do with it! Specifically you can use std::enable_if in a return type or template parameter to conditionally enable an overload.