Sequoia
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
sequoia::testing::impl::dual_allocation_checker< T, Getter > Class Template Reference

Wraps allocation_info, together with two prior allocation counts. More...

#include <AllocationCheckersDetails.hpp>

Public Types

using value_type = T
 
using alloc_info = allocation_info< T, Getter >
 
using predictions_type = typename alloc_info::predictions_type
 
using allocator_type = typename alloc_info::allocator_type
 

Public Member Functions

 dual_allocation_checker (alloc_info i, const T &x, const T &y)
 
const alloc_infoinfo () const noexcept
 
int first_count () const noexcept
 
int second_count () const noexcept
 
template<auto AllocEvent, test_mode Mode>
void check_no_allocation (std::string_view detail, test_logger< Mode > &logger, const T &x, const T &y) const
 
template<test_mode Mode>
void check_copy_assign_y_to_x (test_logger< Mode > &logger, const T &x, const T &y) const
 
template<test_mode Mode>
void check_move_assign_y_to_x (test_logger< Mode > &logger, const T &x) const
 
template<test_mode Mode>
void check_mutation_after_swap (test_logger< Mode > &logger, const T &lhs, const T &rhs) const
 

Detailed Description

template<movable_comparable T, alloc_getter< T > Getter>
class sequoia::testing::impl::dual_allocation_checker< T, Getter >

Wraps allocation_info, together with two prior allocation counts.

Consider two containers, x and y, which in some way interact e.g. via copy/move or swap followed by mutation. The class holds allocation counts (for a given allocator) of both x and y, prior to the operation of interest being performed. The number of allocations after the operation may be acquired by inspecting the Container via the function object stored in allocation_info. Combining this with the result of invoking either first_count() or second_count(), as appropriate, gives a number which may be compared to the appropriate prediction stored within allocation_info.

The main complication is dealing correctly with the various propagation traits.


The documentation for this class was generated from the following file: