diff --git a/include/onnxruntime/core/common/common.h b/include/onnxruntime/core/common/common.h index 7b82bc0c3c..cf6d2138ca 100644 --- a/include/onnxruntime/core/common/common.h +++ b/include/onnxruntime/core/common/common.h @@ -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 AssociativeContainer> +inline bool Contains(const AssociativeContainer& container, const Key& key) { + return container.find(key) != container.end(); +} + } // namespace onnxruntime diff --git a/onnxruntime/core/providers/common.h b/onnxruntime/core/providers/common.h index 22949ed297..c821ff0650 100644 --- a/onnxruntime/core/providers/common.h +++ b/onnxruntime/core/providers/common.h @@ -137,11 +137,6 @@ inline Status ComputePadAndOutputShape(const int64_t in_dim, return Status::OK(); } -template -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