4 ms·
But the C++20 concepts is only concept lite. It does not check the implementation of the template function that it only uses operations available for the concep
by ogoffart 9y ago
But the C++20 concepts is only concept lite. It does not check the implementation of the template function that it only uses operations available for the conceps.
suppose you have a concept Hashable that is only enabled for type with a hash() function. But you can still in the code of your HashMap do a comparison with the < operator, which the Hashable concept don't ensure. In that case you woud only have an error at instentiation type for Hashable types that don't have '<'
In Rust, the compiler make sure that your generic function only use operations that exits in the traits declared in the function signature.