lst-0976-godb.cpp
//#(execute) c++; compiler:g132; options:-O3 -std=c++23; libs:-
// https://godbolt.org/z/Y3GsPd97d
#include <set>
#include <string>
struct Drachen {
std::string name_;
};
namespace std {
template<> struct less<Drachen> { // Templatespezialisierung
bool operator()(const Drachen &lhs, const Drachen &rhs) const {
return lhs.name_ < rhs.name_;
} }; }
int main() {
std::set<Drachen> drachen {
Drachen{"Smaug"},Drachen{"Glaurung"},
Drachen{"Ancalagon"},Drachen{"Scatha"}};
}