MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / search

Function search

simcore/framework/src/cli/cli.hpp:2633–2640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2631/// A search function
2632template <typename T, typename V, enable_if_t<!has_find<T, V>::value, detail::enabler> = detail::dummy>
2633auto search(const T &set, const V &val) -> std::pair<bool, decltype(std::begin(detail::smart_deref(set)))> {
2634 using element_t = typename detail::element_type<T>::type;
2635 auto &setref = detail::smart_deref(set);
2636 auto it = std::find_if(std::begin(setref), std::end(setref), [&val](decltype(*std::begin(setref)) v) {
2637 return (detail::pair_adaptor<element_t>::first(v) == val);
2638 });
2639 return {(it != std::end(setref)), it};
2640}
2641
2642/// A search function that uses the built in find function
2643template <typename T, typename V, enable_if_t<has_find<T, V>::value, detail::enabler> = detail::dummy>

Callers 3

IsMemberMethod · 0.85
TransformerMethod · 0.85
CheckedTransformerMethod · 0.85

Calls 4

beginFunction · 0.85
smart_derefFunction · 0.85
endFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected