python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
How to specialize a type trait using concepts?
I am trying to use C++ concepts in order to write a type trait that will produce a different type depending on whether its template argument is a fundamental type or not:
template<typename T>
co...

Elad Maimoni
Votes: 0
Answers: 1
Concepts: require a function on a type without default constructing that type
I need to require of some type A that there exists a function f(A, A::B).
I'm testing that by calling f with instances of A and A::B. Is there a less ostentatious way to test against an instance of th...

Matt Murphy
Votes: 0
Answers: 2
Enforce class template specializations to provide one or more methods
I'm using a "traits" pattern where I have a base case expressed as a class template
template <class>
struct DoCache {
constexpr static bool value = false;
};
and I expect users to s...

Lorah Attkins
Votes: 0
Answers: 2
How to make a templated parameter to match the function-signature of an outer templated type
Imagine I've got sth. like this:
template<typename Signature>
struct Callable
{
template<typename FnType>
requires std::convertible_to<std::invoke_result_t<FnType>, st...

Bonita Montero
Votes: 0
Answers: 0