MCPcopy Create free account
hub / github.com/fmtlib/fmt / allocator

Class allocator

include/fmt/format.h:729–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727// standard library runtime. std::decay is used for back_inserter to be found by
728// ADL when applied to memory_buffer.
729template <typename T> struct allocator : private std::decay<void> {
730 using value_type = T;
731
732 auto allocate(size_t n) -> T* {
733 FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), "");
734 return static_cast<T*>(detail::allocate(n * sizeof(T)));
735 }
736
737 void deallocate(T* p, size_t) { free(p); }
738
739 constexpr friend auto operator==(allocator, allocator) noexcept -> bool {
740 return true; // All instances of this allocator are equivalent.
741 }
742 constexpr friend auto operator!=(allocator, allocator) noexcept -> bool {
743 return false;
744 }
745};
746
747template <typename Formatter>
748FMT_CONSTEXPR auto maybe_set_debug_format(Formatter& f, bool set)

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68