mimic++ v4
|
A watcher type, which reports it's move-constructor and -assignment calls. More...
#include <ObjectWatcher.hpp>
Public Member Functions | |
~RelocationWatcher ()=default | |
Defaulted destructor. | |
RelocationWatcher ()=default | |
Defaulted default constructor. | |
RelocationWatcher (const RelocationWatcher &other) | |
Copy-constructor. | |
RelocationWatcher & | operator= (const RelocationWatcher &other) |
Copy-assignment-operator. | |
RelocationWatcher (RelocationWatcher &&other) noexcept(false) | |
Move-constructor, which reports a relocation. | |
RelocationWatcher & | operator= (RelocationWatcher &&other) noexcept(false) |
Move-assignment-operator, which reports a relocation. | |
auto | expect_relocate () |
Begins a relocation-expectation construction. | |
A watcher type, which reports it's move-constructor and -assignment calls.
This watcher is designed to track, whether a move has been performed. During a move, it reports the relocation to the framework, which can be tracked by a previously created relocation-expectation.
This watcher can be freely moved around, but any relocation events must match with a previously created relocation-expectation.
This watcher is copyable, but with very special behaviour.
As this watcher is generally designed to be part of a bigger object, it would be very limiting not supporting copy-operations at all. The question is, how should a copy look like?
In general a copy should be a logical duplicate of its source and the general expectation is: if B
is a copy of A
, then A == B
should yield true.
B
is not a copy of A
, then A == B
has to yield false!This won't be the case for RelocationWatcher
s, as active relocation-expectations won't be copied over to the target. In general, if a RelocationWatcher
is used, we want to be very precise with our move, thus an implicit expectation copy would be against the purpose of this helper. Due to this, each RelocationWatcher
will be created as a fresh instance, when copy-construction is used. The same logic also applies to copy-assignment.
|
default |
Defaulted destructor.
|
nodiscarddefault |
Defaulted default constructor.
|
inlinenodiscard |
Copy-constructor.
other | The other object. |
This copy-constructor's purpose is to provide syntactically correct copy operations, but semantically this does not copy anything. In fact, it simply default-constructs the new instance, without even touching the other
.
|
inlinenodiscard |
Move-constructor, which reports a relocation.
other | The other object. |
|
inlinenodiscard |
Begins a relocation-expectation construction.
ScopedExpectation
instance. This can either be done manually or via MIMICPP_SCOPED_EXPECTATION (or the shorthand version SCOPED_EXP).
|
inline |
Copy-assignment-operator.
other | The other object. |
This copy-assignment-operator's purpose is to provide syntactically correct copy operations, but semantically this does not copy anything. In fact, it simply overrides its internals with a fresh instance, without even touching the other
.
|
inline |
Move-assignment-operator, which reports a relocation.
other | The other object. |