requires-expression Questions
1
Solved
A requires-expression similarly to a function can introduce local parameters using a parameter list. And lambda expressions defined at block scope may have captures without initializers. Is it allo...
Interlace asked 25/9 at 19:40
1
Solved
A requires-expression can introduce local parameters using a parameter list. If any of these parameters has void type, will the requires expression just yield false or shall it be hard compilation ...
Northeastwards asked 19/9 at 20:32
1
Solved
I'm writing a concept that checks if a type can be used in an expression that composes 2 functions:
template<typename T>
concept C = requires(T t) {
f(g(t));
};
i.e., I want to check if for...
Dagny asked 12/10, 2023 at 11:21
3
Solved
I want to test whether a type can be passed to some function, but I'd like to use ADL on the function lookup and include a function from a certain namespace.
Consider this code:
#include <utilit...
Athalia asked 2/12, 2022 at 17:3
2
I try to define a concept with a requires expression which checks some member function existence on the type.
The problem I run into is, that a single concept has to be plugged in for the return ty...
Brocket asked 27/5, 2021 at 9:41
1
Solved
#include <type_traits>
template<typename T>
struct IsComplete final
: std::bool_constant<requires{sizeof(T);}>
{};
int main()
{
struct A;
static_assert(!IsComplete<A>::...
Vague asked 23/5, 2021 at 9:46
1
Solved
I am learning the newly implemented concepts of C++20 standard using g++ 10.
I am stuck with a simple type requirement. Namely I want to implement a requirement for a template argument T to have T:...
Hasten asked 2/6, 2020 at 22:21
3
Solved
Let's say, given C++17's if constexpr and Concepts TS (for instance, in recent gcc versions), we'd like to check if a type in a template function has a nested type:
#include <iostream>
stru...
Nutgall asked 6/11, 2017 at 19:32
1
Solved
In the following example, the function arguments are used to test with a requires expression whether an expression using them is well formed. The requires expression takes no arguments; it uses the...
Spiroid asked 5/11, 2019 at 9:5
1
Solved
Look at this simple concept example:
template <typename T>
requires requires(T t) { { t+t } -> bool; }
void fn() {
}
int main() {
fn<bool>();
}
Here, I used bool as the type-const...
Razor asked 2/9, 2019 at 4:36
5
Solved
One of the corners of C++20 constraints is that there are certain situations in which you have to write requires requires. For instance, this example from [expr.prim.req]/3:
A requires-expression ...
Paisa asked 15/1, 2019 at 14:33
1
© 2022 - 2024 — McMap. All rights reserved.