Sequoia
Loading...
Searching...
No Matches
MoveOnlyCheckersDetails.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2020. //
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
15
17{
18 template<test_mode Mode, class Actions, moveonly T, class U, class V, std::invocable<T&> Mutator, class... Args>
19 requires checkable_against_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
20 bool check_semantics(test_logger<Mode>& logger,
21 const Actions& actions,
22 T&& x,
23 T&& y,
24 const U& xEquivalent,
25 const U& yEquivalent,
26 optional_ref<const V> movedFromPostConstruction,
27 optional_ref<const V> movedFromPostAssignment,
28 Mutator m,
29 const Args&... args)
30 {
31 sentinel<Mode> sentry{logger, ""};
32
33 if(!check_prerequisites(logger, actions, x, y, xEquivalent, yEquivalent, args...))
34 return false;
35
36 auto opt{check_move_construction(logger, actions, std::move(x), xEquivalent, movedFromPostConstruction, args...)};
37 if(!opt) return false;
38
39 if constexpr (do_swap<Args...>::value)
40 {
41 if(check_swap(logger, actions, std::move(*opt), std::move(y), xEquivalent, yEquivalent, args...))
42 {
43 check_move_assign(logger, actions, y, std::move(*opt), yEquivalent, movedFromPostAssignment, std::move(m), args...);
44 }
45 }
46 else
47 {
48 check_move_assign(logger, actions, *opt, std::move(y), yEquivalent, movedFromPostAssignment, std::move(m), args...);
49 }
50
51 if constexpr (serializable_to<T, std::stringstream> && deserializable_from<T, std::stringstream>)
52 {
53 check_serialization(logger, actions, std::move(x), yEquivalent, args...);
54 }
55
56 return !sentry.failure_detected();
57 }
58}
Implementation details for semantics checks that cleanly supports types which do/do not have allocato...
Condition for applying a container check.
Definition: AllocationCheckersDetails.cpp:15