You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2019/11/08 13:25:18 UTC
[mesos] 02/15: Added 'nodiscard' attribute to some member functions
of Resources.
This is an automated email from the ASF dual-hosted git repository.
bennoe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit c00595446f00ee4d139ee45f829644a512795ffd
Author: Benno Evers <be...@mesosphere.com>
AuthorDate: Thu Nov 7 14:55:20 2019 +0100
Added 'nodiscard' attribute to some member functions of Resources.
Added the `[[nodiscard]]` attribute to `Resources::pushReservation()`
and `Resources::popReservation()`, in order to prevent mistakes by
authors incorrectly assuming that these functions would modify the
resources objects in place.
Review: https://reviews.apache.org/r/71735/
---
include/mesos/resources.hpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/mesos/resources.hpp b/include/mesos/resources.hpp
index b8aef28..dbfa9c9 100644
--- a/include/mesos/resources.hpp
+++ b/include/mesos/resources.hpp
@@ -523,11 +523,12 @@ public:
// Returns a `Resources` object with the new reservation added to the back.
// The new reservation must be a valid refinement of the current reservation.
- Resources pushReservation(const Resource::ReservationInfo& reservation) const;
+ STOUT_NODISCARD Resources pushReservation(
+ const Resource::ReservationInfo& reservation) const;
// Returns a `Resources` object with the last reservation removed.
// Every resource in `Resources` must have `resource.reservations_size() > 0`.
- Resources popReservation() const;
+ STOUT_NODISCARD Resources popReservation() const;
// Returns a `Resources` object with all of the reservations removed.
Resources toUnreserved() const;