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.
16 questions
2 votes
0 answers
155 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 ...
5 votes
1 answer
642 views
Using SFINAE to provide "default" output operators
I am an undergraduate CS student trying to implement simple unit test framework on C++ as a pet project. The framework has an assertion macro like ...
6 votes
1 answer
296 views
Emulating Virtual Registers Part 3
Forward This is a continuation of my work in progress and the last iteration that I posted can be found here. I have designed a compact class template that uses SFINAE with constructor delegation to ...
3 votes
1 answer
1k views
Implementation of static_vector using an array of std::aligned_storage, with std::launder and forwarding
I'm trying to expand on the implementation of static_vector on the std::aligned_storage reference page, but would like to split it into two parts. First, an ...
5 votes
0 answers
170 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 ...
0 votes
1 answer
1k views
SFINAE with several condition [Refactoring] [closed]
How can I write this function shorter? ...
10 votes
3 answers
1k views
C++ Vector The basics
Following on from my two previous posts. An alternative vector An Alternative Vector (Copy Assignment Operator) I have written a detailed blog about how to write a minimal vector like class. This set ...
9 votes
1 answer
5k views
Continuation Implementation in C++11
While playing with the concurrency features in C++11 I noticed that there wasn't any support for continuations. I wanted to develop something similar to Tasks in The Parallel Patterns Library (PPL), ...