February 2020
Intermediate to advanced
292 pages
8h 54m
English
In this section, we will develop a concrete template example using concepts:
#include <algorithm>#include <concepts>namespace sp{ template<typename T> requires Sortable<T> void sort(T& container) { std::sort (begin(container), end(container)); };}
int main(){ std::vector<int> myVec {2,1,4,3}; sp::sort(vec); return 0;}
We'll look at the details in the next section.
Read now
Unlock full access