Permalink
Browse files

Have MutlipartHeaders.operator[] return a const reference for improve…

…d efficiency.
  • Loading branch information...
1 parent 91a7d86 commit 89e87147096b81d5687af60f46b70ff79ff9b16b @FooBarWidget committed Jul 6, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 MultipartReader.h
View
@@ -6,11 +6,13 @@
#include "MultipartParser.h"
class MultipartHeaders: public std::multimap<std::string, std::string> {
+private:
+ std::string empty;
public:
- std::string operator[](const std::string &key) const {
+ const std::string &operator[](const std::string &key) const {
const_iterator it = find(key);
if (it == end()) {
- return std::string();
+ return empty;
} else {
return it->second;
}

0 comments on commit 89e8714

Please sign in to comment.