17template <
class T,
class Allocator>
18std::size_t vector_capacity_bytes(
const std::vector<T, Allocator>& values) {
19 return values.capacity() *
sizeof(T);
27 { value.memory_usage_bytes() } -> std::convertible_to<std::size_t>;
37template <HasMemoryUsageBytes T>
38std::size_t nested_owned_memory_bytes(
const T& value) {
39 const std::size_t total = value.memory_usage_bytes();
40 return total >
sizeof(T) ? total -
sizeof(T) : 0;
46template <HasMemoryUsageBytes T>
47std::size_t optional_nested_owned_memory_bytes(
const std::optional<T>& value) {
48 return value.has_value() ? nested_owned_memory_bytes(*value) : 0;
Concept for types that expose total owned memory usage in bytes.
Definition memory_usage.h:26