``trompeloeil_movable_mock`` only provides move-ctor
DNKpp opened this issue · 3 comments
Trompeloeil's mocks should be movable, when the bool member trompeloeil_movable_mock
is set to true
. But currently it is limited to move-construction; move-assignment is not supported. Is there a reason for this? Or is it just a bug?
A simple fix would be just the line: expectations& operator =(expectations&&) = default;
in the struct expectations
definition.
Btw, as a side-note: it's never a good idea to explicitly specify noexcept
on defaulted functions, as this is can and will be overriden by compilers. => expectations(expectations&&) noexcept = default;
Is this a question from a philosophical point of view, or do you have a real world use case?
The latter seems to be a mistake (unless it was added as a work-around for some old compiler, I don't remember). I'll remove it (possibly conditionally depending on compiler).
Well, I often stumble across this. I sometimes simply want to setup expectations on a mock and then move it somewhere and do not care, whether it's moved somewhere else or not.
The most annoying fact is, that mock types can not be used as template types, where std::movable
(or any depending concept) is required.
OK. Thanks. I'll look into it. I'm somewhat afraid that it'll open a can of worms, but I understand your situation.