this post was submitted on 13 May 2024
4 points (61.1% liked)
C++
1761 readers
1 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yeah, that's confusing to read. A hashset can only contain at most one of each cheese kind, in c++20 you can write
inventory.contains(cheeseName)
, before that you had to use.count
orinventory.find(cheeseName) != inventory.end()
or something like that