I'm playing around with C++ concepts and came across an interesting problem. I have the following two custom-defined concepts: As the names suggest ...
I'm playing around with C++ concepts and came across an interesting problem. I have the following two custom-defined concepts: As the names suggest ...
In the following code, the can_foo concept tests whether or not a foo() member function can be called on an instance of a type. I will use it to test ...
The following code declares that the function returned by the function Foo must model a function that takes 1 int and returns an int. #include <fu ...
It's easy to write template function override with concept, but I don't know how to write template class partial specialization :( This doesn't wor ...
I'm still rather new to TMP so forgive me if this is a poorly worded question. I'm trying to make a very generic mathematical Vector class to store a ...
How can I write a C++ requires expression that looks for specific member functions or static functions, with specific argument types? For example: s ...
How can I make the following code compile? I'm trying to check if BigStruct exist in a type, and enable f if it does. Error I got: Here's a god ...
I am trying to create a function that will initialize an internal std::set<std::string>, and I want to expose an API that allows any type of ran ...
I just encountered a case where I wanted to declare a C++ 20 concept deprecated. However it seems like my compiler (Apple Clang 14) does not accept ad ...
By the requeriments specified by the std::input_iterator concept, (and supperior iterators seems to be the same), they have to provide copy and move c ...
#include <concepts> #include <tuple> template<std::integral... Is> using arithmetic_tuple = std::tuple<Is...>; template<t ...
I am trying to mimic the can-referece exposition only concept, that can be found in the new C++20 iterator concepts. Extracted from cppreferece: S ...
Clang and gcc complains 'pack expansion used as argument for non-pack parameter of concept' at the 2nd line. MSVC compiles. Are the code well-formed ...
Why do some of these implementations of a "Oneable" concept using requires expressions in C++ 20 not compile on certain compilers? // `Oneable` imple ...
Suppose I have a concept MyConcept that describes the requirements for a generic algorithm algo. In the examples code below, the only requirement is a ...
In C++20 it is possible to write a wrapper class which only accepts string literals. from OP's own answer here https://stackoverflow.com/a/7492295 ...
I have a list of types TypeList. I am currently using a tuple to hold these types. What I want is the following: Given a new type X - check if at lea ...
Where is the right position of a concept or constraint? The following code compile: but if I change the position of the function f(int) to: thi ...
The language specification, when introducing Concepts, implicitly disallows type traits to be used in type-constraint contexts in lieu of concepts: ...
I've been trying to implement checking to see if a type is a specialization of a specific template. I have seen quite a few answers online, but most o ...