Home | History | Annotate | Download | only in xla

Lines Matching defs:key

29 // the given key if it exists. Crashes otherwise.
32 // when the key is guaranteed to exist.
36 const typename Collection::value_type::first_type& key) {
37 typename Collection::const_iterator it = collection.find(key);
38 CHECK(it != collection.end()) << "Map key not found: " << key;
46 const typename Collection::value_type::first_type& key) {
47 typename Collection::iterator it = collection.find(key);
48 CHECK(it != collection.end()) << "Map key not found: " << key;
52 // Like FindOrDie but returns an error instead of dying if `key` is not in
58 const typename Collection::value_type::first_type& key) {
59 typename Collection::const_iterator it = collection.find(key);
62 os << key;
63 return NotFound("key not found: %s", os.str().c_str());
68 // Returns a const reference to the value associated with the given key if it
80 const typename Collection::value_type::first_type& key,
82 auto it = collection.find(key);
87 // Inserts the key-value pair into the collection. Dies if key was already
91 const typename Collection::value_type::first_type& key,
93 auto p = collection->insert(std::make_pair(key, data));
94 CHECK(p.second) << "duplicate key: " << key;
97 // Returns true if and only if the given collection contains the given key.
98 template <class Collection, class Key>
99 bool ContainsKey(const Collection& collection, const Key& key) {
100 return collection.find(key) != collection.end();