+ const_iterator find(const char *Key) const {
+ return find(Key, Key + strlen(Key));
+ }
+ const_iterator find(const std::string &Key) const {
+ return find(Key.data(), Key.data() + Key.size());
+ }
+
+ /// lookup - Return the entry for the specified key, or a default
+ /// constructed value if no such entry exists.
+ ValueTy lookup(const char *KeyStart, const char *KeyEnd) const {
+ const_iterator it = find(KeyStart, KeyEnd);
+ if (it != end())
+ return it->second;
+ return ValueTy();
+ }
+ ValueTy lookup(const char *Key) const {
+ const_iterator it = find(Key);
+ if (it != end())
+ return it->second;
+ return ValueTy();
+ }
+ ValueTy lookup(const std::string &Key) const {
+ const_iterator it = find(Key);
+ if (it != end())
+ return it->second;
+ return ValueTy();
+ }
+
+ ValueTy& operator[](const char *Key) {
+ return GetOrCreateValue(Key, Key + strlen(Key)).getValue();
+ }
+ ValueTy& operator[](const std::string &Key) {
+ return GetOrCreateValue(Key.data(), Key.data() + Key.size()).getValue();
+ }
+
+ size_type count(const char *KeyStart, const char *KeyEnd) const {
+ return find(KeyStart, KeyEnd) == end() ? 0 : 1;
+ }
+ size_type count(const char *Key) const {
+ return count(Key, Key + strlen(Key));
+ }
+ size_type count(const std::string &Key) const {
+ return count(Key.data(), Key.data() + Key.size());
+ }