mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-27 20:02:15 +00:00
Move Contains() helper function to a higher common.h. (#11289)
This commit is contained in:
parent
7aa4af238a
commit
4d0214f851
2 changed files with 8 additions and 5 deletions
|
|
@ -286,4 +286,12 @@ inline std::string ToWideString(const std::string& s) { return s; }
|
|||
|
||||
constexpr size_t kMaxStrLen = 2048;
|
||||
|
||||
// Returns whether `key` is in `container`.
|
||||
// Like C++20's map/set contains() member function.
|
||||
template <typename Key, typename... OtherContainerArgs,
|
||||
template <typename...> typename AssociativeContainer>
|
||||
inline bool Contains(const AssociativeContainer<Key, OtherContainerArgs...>& container, const Key& key) {
|
||||
return container.find(key) != container.end();
|
||||
}
|
||||
|
||||
} // namespace onnxruntime
|
||||
|
|
|
|||
|
|
@ -137,11 +137,6 @@ inline Status ComputePadAndOutputShape(const int64_t in_dim,
|
|||
return Status::OK();
|
||||
}
|
||||
|
||||
template <class AssociativeContainer, class Key>
|
||||
inline bool Contains(const AssociativeContainer& container, const Key& key) {
|
||||
return container.find(key) != container.end();
|
||||
}
|
||||
|
||||
// Note: This helper function will not have overflow protection
|
||||
template <template <typename...> class Container, typename T>
|
||||
T Product(const Container<T>& c) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue