I have a class Foo that can be constructed from C-style strings, string views and non-temporary strings (in reality it contains other members and meth ...
I have a class Foo that can be constructed from C-style strings, string views and non-temporary strings (in reality it contains other members and meth ...
I'm currently studying enable_if and I have this code: //template<typename T, typename = int/double/float/...> //not working properly template& ...
I have a user defined class template<typename T, int N> class MyClass { // Implementation }; and I want to check on the instantiation of anot ...
I need an image class template which will work with images with different number of dimensions and different format. And I also want to define differe ...
I want to see if a map implementation supports incomplete types, as libc++ seems to support them, but not stdlibc++. I tried SFINAE here, but it give ...
I try to write a metafunction type_par_same_as that selects true_type whenever the template parameter(s) of a class match the given types: Demo He ...
I've learnt SFINAE in c++. Then I wrote the following program that compiles(and executes) with msvc but not with gcc and clang. Live demo As we can ...
I maintain an Arduino library which uses the following code (simplified) to print results received by infrared. Most of the 32 bit arduino cores pr ...
I have two class specializations. I want one of them to be used when T::A exists and the other to be used when T::B exists, which should be multually ...
SFINAE, "Substitutation Failure Is Not An Error", is a well-known rule/technique applied during overload resolution of function templates (see e.g. SF ...
I have a derived class, Wrapper, that inherits from a template-defined base class. I'd like to configure Wrapper so that if the base class has constru ...
Currently, I have this templated function in my codebase, which works pretty well in C++17: The function has two problems, though: It uses if c ...
Inspired by SFINAE to check if std::less will work, I come to this: with the intention that if < has been defined for type F, Queue will be std: ...
On the one hand, the function boost::hana::is_valid is presented as follows Checks whether a SFINAE-friendly expression is valid. Given a SFINAE ...
Boost.Hana offers boost::hana::is_valid to check whether a SFINAE-friendly expression is valid. You can use it like this struct Person { std::st ...
I want to write a generic accessor for a class member regardless whether it is a function or or a data member: I am using SFINAE with void_t specia ...
I saw this example of using SFINAE to check if a type is streamable here. However, I noticed that it is not portable, i.e. returns different results f ...
I want to handle noncopyable type by reference when SFINAE get unkown input, my code below can't work, is there a better way? ...
I'm writing an extensible library where it has become convenient to overload STL's to_string() for custom types. For that I've designed a generic over ...
I am trying to create a class holding std::variant with a member function that would only accept types held by the nested variant object. That functi ...