Log In
0% completed
All Lessons
Free Lessons (4)
Introduction
Getting Started
Why C++ Concepts?
The Concept Behind C++ Concepts
Use of Concepts
Motivation Behind C++ Concepts
Templates in C++
Quiz on C++ Templates
Highlights
Four Ways to use Concepts in Functions
The Four Ways to Use Concepts
The <requires> Clause
Challenge - GCD of Two Integers Using the <requires> Clause
Solution: GCD of Two Integers Using the <requires> Clause
The Trailing <requires> Clause
Challenge: GCD of Two Real Numbers Using the Trailing <requires>
Solution: GCD of Two Real Numbers Using the Trailing <requires> c
The Constrained Template Parameter
The abbreviated Function Templates
Concepts at Compile-time
How to Choose Among the Four Ways?
Quiz on the Ways to Use the C++ Concepts
Conclusion
C++ Concepts with Classes
Introduction
The Requires Clause
Challenge: Implement a Pair Class Using Requires Clause
Solution: Implement KeyPair Class Using <requires> Clause
Constrained Template Parameters
Challenge: Array Class Using Constrained Template Parameters
Solution: Array Class Using Constrained Template Parameters
The Trailing Requires Clause
Quiz on C++ Concepts with Classes
Key Takeaways
Concepts Shipped with the C++ Standard Library
Concepts in the <concepts> Header - I
Concepts in the <concepts> Header (cont.)
Concepts in the <iterator> Header
Concepts in the <ranges> Header
Quiz on the Concepts Shipped with C++ Standard Library
Challenge: A Custom Concept Using Concepts from the C++ STL
Solution: A Custom Concept Using Concepts from the C++ STL
Conclusion
How to Write Your Own C++ Concepts
Introduction
Negations Using Concepts
Subsumption and Negations
Challenge: Fix the Code
Solution: Fix the Error in the Code
Requirements on Operations
Simple Requirements on the Interface
Full Example of Interface
Requirements on Return Types
Challenge: Concept for a Container
Solution: Concept for a Container
Type Requirements - Require the Existence of a Nested Type
A Class Template Specialization
An Alias Template Specialization
Challenge: Concept for a Container
Solution: Concept for a Container
Nested Requirements
Challenge: Concept for a Container
Solution: Concept for a Container
Quiz: Write Our Own C++ Concepts
Conclusion
How to Use C++ Concepts in Real Life
Use Cases for Numbers
Utility Functions Constrained
Multiple Destructors with C++ Concepts
Multiple Destructors with C++20
Challenge: Container Class with Multiple Destructors
Solution: Container Class with Multiple Destructors
Quiz: C++ Concepts in Real Life
Conclusion
Summary
Final Words
C++ Concepts: Improve Type Safety with C++ 20
/
...
/
Challenge: Concept for a Container
Challenge: Concept for a Container
Let’s try to implement a concept ourselves!
We'll cover the following...
Problem
Problem
...