I understand the definition of two templates.
But I don't know under what circumstances this would actually be useful.
Could you show an example code where it is used under what circumstances?
Remark
I understand the definition of two templates.
But I don't know under what circumstances this would actually be useful.
Could you show an example code where it is used under what circumstances?
Remark
I think in a really brief way this is the difference between them:
std::semiregular - > a semiregular type has to support the rule of five: and has to be swappable
std::regular -> same as semiregular, but you requires that the type is equality comparable
For both of them you already have simple examples how they work (the links on the question).
Now, how I see this useful in the projects. You probably can use this concept to check if your object, when passed as template type, respect the rule of five - so you can use semiregular for this. The example I gave is a very generic one, but definitely should be more. Take a look at the following link which has more details about this: https://www.modernescpp.com/index.php/c-20-define-the-concept-regular-and-semiregular .