aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/immutable/sorted_map.h
diff options
context:
space:
mode:
authorGravatar Konstantin Varlamov <var-const@users.noreply.github.com>2018-07-09 13:56:06 -0400
committerGravatar GitHub <noreply@github.com>2018-07-09 13:56:06 -0400
commit637e5aa468ab0c3b1faa3b7970ad3e91fb6c6f74 (patch)
treebcee145fb8095fb8bf5b6949bfa6901e2677a546 /Firestore/core/src/firebase/firestore/immutable/sorted_map.h
parenta5eb8952f8eadf1f59de1b0e7e9b91d497664fa7 (diff)
C++: for immutable data structures, forbid ignoring result of insert/erase
Diffstat (limited to 'Firestore/core/src/firebase/firestore/immutable/sorted_map.h')
-rw-r--r--Firestore/core/src/firebase/firestore/immutable/sorted_map.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Firestore/core/src/firebase/firestore/immutable/sorted_map.h b/Firestore/core/src/firebase/firestore/immutable/sorted_map.h
index 3a50020..21dcfd4 100644
--- a/Firestore/core/src/firebase/firestore/immutable/sorted_map.h
+++ b/Firestore/core/src/firebase/firestore/immutable/sorted_map.h
@@ -25,6 +25,7 @@
#include "Firestore/core/src/firebase/firestore/immutable/sorted_map_iterator.h"
#include "Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h"
#include "Firestore/core/src/firebase/firestore/util/comparison.h"
+#include "absl/base/attributes.h"
namespace firebase {
namespace firestore {
@@ -166,7 +167,7 @@ class SortedMap : public impl::SortedMapBase {
* @param value The value to associate with the key.
* @return A new dictionary with the added/updated value.
*/
- SortedMap insert(const K& key, const V& value) const {
+ ABSL_MUST_USE_RESULT SortedMap insert(const K& key, const V& value) const {
switch (tag_) {
case Tag::Array:
if (array_.size() >= kFixedSize) {
@@ -193,7 +194,7 @@ class SortedMap : public impl::SortedMapBase {
* @param key The key to remove.
* @return A new map without that value.
*/
- SortedMap erase(const K& key) const {
+ ABSL_MUST_USE_RESULT SortedMap erase(const K& key) const {
switch (tag_) {
case Tag::Array:
return SortedMap{array_.erase(key)};