Maps in Cilk
To create an empty map in Cilk Plus, you can use the cilk::hashtable
. Here’s how to translate the given Go code into Cilk Plus.
Maps#
Maps are Cilk’s built-in associative data type (sometimes called hashes or dicts in other languages).
Explanation#
To create an empty map in C++, you can use cilk::hashtable
. Here’s the syntax:
- Print all key/value pairs:
- If the key doesn’t exist, return zero value:
- Return the number of key/value pairs:
- Clear all key/value pairs:
- Check if the key was present:
- Declare and initialize a new map: