MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / binary_find

Function binary_find

src/IFaceTable.cpp:27–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26template<typename Iter>
27typename std::iterator_traits<Iter>::value_type const *binary_find(Iter begin, Iter end, const char *name) {
28 auto it = std::lower_bound(begin, end, name, [](const auto &lhs, const char *rhs) {
29 return strcmp(lhs.name, rhs) < 0;
30 });
31
32 if (it == end || strcmp(name, it->name) != 0) {
33 return nullptr;
34 }
35 else {
36 return &(*it);
37 }
38}
39
40const IFaceConstant *IFaceTable::FindConstant(const char *name) const {
41 return binary_find(constants.cbegin(), constants.cend(), name);

Callers 3

FindConstantMethod · 0.85
FindFunctionMethod · 0.85
FindPropertyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected