Sequoia
Loading...
Searching...
No Matches
AllocationCheckersCore.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2022. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
51
52#include <string>
53
54namespace sequoia::testing
55{
56 enum class container_tag : bool { x, y };
57
58 template<container_tag tag>
59 struct container_tag_constant : std::integral_constant<container_tag, tag>
60 {};
61
62 [[nodiscard]]
63 std::string to_string(container_tag tag);
64
65 template<movable_comparable T, alloc_getter<T> Getter>
66 class allocation_info;
67
68 enum class null_allocation_event { comparison, spectator, serialization, swap };
69
71 template<auto Event>
73 {
74 public:
75 constexpr alloc_prediction() = default;
76
77 constexpr alloc_prediction(int unshifted, int delta = {}) noexcept
78 : m_Unshifted{unshifted}
79 , m_Prediction{m_Unshifted + delta}
80 {}
81
82 [[nodiscard]]
83 constexpr int value() const noexcept
84 {
85 return m_Prediction;
86 }
87
88 [[nodiscard]]
89 constexpr int unshifted() const noexcept
90 {
91 return m_Unshifted;
92 }
93 private:
94 int m_Unshifted{}, m_Prediction{};
95 };
96
97 template<class T>
99}
Traits and Concepts for allocation checks.
Definition: AllocationCheckersCore.hpp:73
Class for use with a container possessing a (shared counting) allocator.
Definition: AllocationCheckers.hpp:425
Definition: AllocationCheckers.hpp:200
Definition: AllocationCheckersCore.hpp:60