Skip to content

Commit d369075

Browse files
authored
Add return value to MapInsert (#1664)
1 parent 96f0699 commit d369075

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Shared/sdk/SharedUtil.FastHashSet.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ namespace SharedUtil
4545
//
4646
// CFastHashSet helpers
4747
//
48+
49+
// Return true if the insertion took place
4850
template <class T, class T2>
49-
void MapInsert(CFastHashSet<T>& collection, const T2& item)
51+
bool MapInsert(CFastHashSet<T>& collection, const T2& item)
5052
{
51-
collection.insert(item);
53+
return std::get<bool>(collection.insert(item));
5254
}
5355

54-
// Remove key from collection
56+
// Return true if the remove took place
5557
template <class T, class T2>
5658
bool MapRemove(CFastHashSet<T>& collection, const T2& key)
5759
{

Shared/sdk/SharedUtil.Map.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ namespace SharedUtil
203203
// std::set helpers
204204
//
205205

206-
// Update or add an item
206+
// Return true if the insertion took place
207207
template <class T, class TR, class T2>
208-
void MapInsert(std::set<T, TR>& collection, const T2& item)
208+
bool MapInsert(std::set<T, TR>& collection, const T2& item)
209209
{
210-
collection.insert(item);
210+
return std::get<bool>(collection.insert(item));
211211
}
212212

213213
} // namespace SharedUtil

0 commit comments

Comments
 (0)