MCPcopy Create free account
hub / github.com/docopt/docopt.cpp / fix_identities

Method fix_identities

docopt_private.h:187–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185 PatternList const& children() const { return fChildren; }
186
187 virtual void fix_identities(UniquePatternSet& patterns) {
188 for(auto& child : fChildren) {
189 // this will fix up all its children, if needed
190 if (auto bp = dynamic_cast<BranchPattern*>(child.get())) {
191 bp->fix_identities(patterns);
192 }
193
194 // then we try to add it to the list
195 auto inserted = patterns.insert(child);
196 if (!inserted.second) {
197 // already there? then reuse the existing shared_ptr for that thing
198 child = *inserted.first;
199 }
200 }
201 }
202
203 virtual size_t hash() const override {
204 size_t seed = typeid(*this).hash_code();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected