Skip to main content

Questions tagged [sfinae]

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. This exploit can be used as a means to implement several template metaprogramming techniques.

3 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
163 views

Using SFINAE with wrappers to terminate compilation early

The Goal Provide some wrappers to a C++11 template library's main entry point so that if the initial template parameter is not valid, the user is informed of exactly what is missing. In the real ...
svenevs's user avatar
  • 205
2 votes
0 answers
146 views

Improving constexpr invoke function C++17, alternative to std::invoke

I've learned that in C++17, std::invoke isn't constexpr. To make a constexpr version, I could copy the implementation provided here: https://en.cppreference.com/w/cpp/utility/functional/invoke , OR I ...
Steve Zhang's user avatar
1 vote
0 answers
224 views

Making std::optional a monad via SFINAE

To practice with SFINAE, template meta programming, functional programming and monads in C++, I decided to try writing a skinny version of the two functions (monadic binding and return) that make <...
Enlico's user avatar
  • 537