]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
common/bl: introduce rvalue taking claim_append().
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 22 Jun 2020 21:08:49 +0000 (21:08 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 22 Jun 2020 22:08:20 +0000 (22:08 +0000)
commit5d8fff13fc29cc3f379aae8e4437d0294b65f82b
tree1b7185d5cc7a0acec58c2ae36d5f897e54509d6c
parentf5c2b76e15b1242b4c707c074f0b7fece821d576
common/bl: introduce rvalue taking claim_append().

The motivation is to stop prohibiting callers from
directly passing temporaries. It was not infrequent
to see constructs like:

  ```cpp
  {
    // ...
    auto tmp = produce_bl();
    other_bl.claim_append(tmp);
  }
  ```

They were necessary because `claim_append(bufferlist&)`
requires lvalue reference to which an rvalue can't bind.

This patch fixes the problem by introducing `&&`-taking
variant of `claim_append()`. In the future it could
actually supersede the original one.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/include/buffer.h