11
you are viewing a single comment's thread
view the rest of the comments
[-] CameronDev@programming.dev 4 points 5 months ago

I got stuck on cheese counting:

inventory.count(cheeseName) == 1 ? "Yes" : "No"

1 cheese == some, 2 cheese == none :/

[-] rasensprenger@feddit.de 3 points 5 months ago

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 or inventory.find(cheeseName) != inventory.end() or something like that

this post was submitted on 13 May 2024
11 points (100.0% liked)

C++

1740 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS