Clean up code handling both std::vector and SmallVector (#2493)

This commit is contained in:
Cheng
2025-08-16 09:01:10 +09:00
committed by GitHub
parent 888b13ed63
commit 37b440faa8
4 changed files with 30 additions and 56 deletions

View File

@@ -519,6 +519,18 @@ class SmallVector {
std::is_trivially_destructible<T>::value;
};
template <typename>
struct is_vector : std::false_type {};
template <typename T, size_t Size, typename Allocator>
struct is_vector<SmallVector<T, Size, Allocator>> : std::true_type {};
template <typename T, typename Allocator>
struct is_vector<std::vector<T, Allocator>> : std::true_type {};
template <typename Vec>
inline constexpr bool is_vector_v = is_vector<Vec>::value;
#undef MLX_HAS_BUILTIN
#undef MLX_HAS_ATTRIBUTE
#undef MLX_LIKELY