About 2,230,000 results
Open links in new tab
  1. c++20 - How to use a C++ requires clause in a concept to require …

    Aug 10, 2020 · 7 I was watching a C++ 20 Concepts Presentation , and when attempting to reproduce the code I seem to be stuck. I am trying to require that the root of the tree should …

  2. Why do we need the concept keyword in C++20? - Stack Overflow

    Feb 20, 2023 · Concepts are great, don't get me wrong, but why do we need another keyword for this? Consider the following example: #include <type_traits> template <typename T> concept …

  3. C++ Concepts: checking for template instantiation

    Jan 14, 2019 · Assuming I have a templated type, e.g. template&lt;typename A, typename B, typename C&gt; struct mytype { }; How do I write a concept that checks whether a type is an …

  4. c++ - C++20: Concepts of multiple types and its constraint, …

    Jul 11, 2019 · C++20: Concepts of multiple types and its constraint, correct syntax? Asked 6 years, 2 months ago Modified 6 years, 1 month ago Viewed 7k times

  5. C++ concept that a type is same_as any one of several types?

    I would like to define a concept that indicates a type is one of several supported types. I can do this by repeatedly listing the types with std::same_as<T, U>: #include <concepts> te...

  6. template meta programming - C++ Concepts - Can I have a …

    Oct 15, 2019 · I have a simple code snippet below, which compiles using: g++-9 -std=c++2a -fconcepts This is trying to define a concept that requires the presence of a function. I would …

  7. c++ - Concept definition requiring a constrained template …

    Jun 6, 2016 · Note: everything that follows uses the Concepts TS implementation in GCC 6.1 Let's say I have a concept Surface, like the following: template &lt;typename T&gt; concept …

  8. c++ - How do I use concepts in if-constexpr? - Stack Overflow

    Feb 7, 2019 · How does one use concepts in if constexpr? Given the example below, what would one give to if constexpr to return 1 in case T meets the requirements of integral and else 0? …

  9. How can I use C++ concepts with type_traits? - Stack Overflow

    Jan 4, 2021 · I want to abstract type interfaces and I am having a hard time to decide between the two C++ means of concepts and type_traits. Consider the follow scenario: template …

  10. How to make a concept fail with a custom error message (C++20)

    Aug 25, 2020 · However, most likely inspired by this StackOverflow Q&A, the topic has resuscitated on r/cpp, as the thread Custom 'diagnostics' for concepts, which discusses an …