MCPcopy Create free account
hub / github.com/Apress/design-patterns-in-modern-cpp / add

Method add

Structural/Flyweight/flyweight.cpp:56–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 static int seed;
55
56 static key add(const string& s)
57 {
58 auto it = names.right.find(s);
59 if (it == names.right.end())
60 {
61 // add it
62 key id = ++seed;
63 names.insert({seed, s});
64 return id;
65 }
66 return it->second;
67 }
68 key first_name, last_name;
69};
70

Callers

nothing calls this directly

Calls 1

endMethod · 0.45

Tested by

no test coverage detected