Lines Matching refs:Collection
31 template <class Collection>
32 const typename Collection::value_type::second_type& FindWithDefault(
33 const Collection& collection,
34 const typename Collection::value_type::first_type& key,
35 const typename Collection::value_type::second_type& value) {
36 typename Collection::const_iterator it = collection.find(key);
37 if (it == collection.end()) {
43 // Inserts the given key and value into the given collection if and only if the
44 // given key did NOT already exist in the collection. If the key previously
45 // existed in the collection, the value is not changed. Returns true if the
47 template <class Collection>
48 bool InsertIfNotPresent(Collection* const collection,
49 const typename Collection::value_type& vt) {
50 return collection->insert(vt).second;
54 template <class Collection>
56 Collection* const collection,
57 const typename Collection::value_type::first_type& key,
58 const typename Collection::value_type::second_type& value) {
59 return InsertIfNotPresent(collection,
60 typename Collection::value_type(key, value));