1 // Copyright 2022 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_ALLOCATOR_DISPATCHER_INTERNAL_TOOLS_H_ 6 #define BASE_ALLOCATOR_DISPATCHER_INTERNAL_TOOLS_H_ 7 8 #include <cstddef> 9 10 namespace base::allocator::dispatcher::internal { 11 LessEqual(size_t lhs,size_t rhs)12constexpr bool LessEqual(size_t lhs, size_t rhs) { 13 return lhs <= rhs; 14 } 15 Equal(size_t lhs,size_t rhs)16constexpr bool Equal(size_t lhs, size_t rhs) { 17 return lhs == rhs; 18 } 19 20 struct IsValidObserver { 21 template <typename T> operatorIsValidObserver22 constexpr bool operator()(T const* ptr) const noexcept { 23 return ptr != nullptr; 24 } 25 }; 26 27 } // namespace base::allocator::dispatcher::internal 28 29 #endif // BASE_ALLOCATOR_DISPATCHER_INTERNAL_TOOLS_H_ 30