]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
crimson: introduce assert_moveable().
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 28 Jun 2021 23:52:47 +0000 (23:52 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 29 Jun 2021 14:55:51 +0000 (14:55 +0000)
commitfad97b35430fcfb1ef963c0107c7b0de66a8b5e2
treeb02004c452c19d12e4390a210d4a343a424bfd01
parent566a8a9888adeeebd897cbfccb9d7c4940687571
crimson: introduce assert_moveable().

In C++ `std::moving` a `const`-qualified value yields a constant
r-value reference (`const T&&`) which won't be matched with a callable
taking non-constant r-value reference (like move constructors) but
can play with one taking a constant l-value reference (like copy
constructors do). This behaviour is surprising especially in lambas
where adding or removing the `mutable` specifier may lead to different
behaviour. The problem isn't obvious and it's easy to wrongly drop
the `mutable` druing a clean-up. Therefore introducing a tool for
developers to fail at compile-time if that happens seems desired.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/common/utility.h [new file with mode: 0644]
src/crimson/os/seastore/onode_manager/staged-fltree/node.cc