diff options
Diffstat (limited to 'src/mongo/bson/mutable/algorithm.h')
-rw-r--r-- | src/mongo/bson/mutable/algorithm.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/bson/mutable/algorithm.h b/src/mongo/bson/mutable/algorithm.h index c6c90738cba..8646e429a0b 100644 --- a/src/mongo/bson/mutable/algorithm.h +++ b/src/mongo/bson/mutable/algorithm.h @@ -59,14 +59,14 @@ namespace mutablebson { /** A predicate for findElement that matches on the field name of Elements. */ struct FieldNameEquals { // The lifetime of this object must be a subset of the lifetime of 'fieldName'. - explicit FieldNameEquals(const StringData& fieldName) + explicit FieldNameEquals(StringData fieldName) : fieldName(fieldName) {} bool operator()(const ConstElement& element) const { return (fieldName == element.getFieldName()); } - const StringData& fieldName; + StringData fieldName; }; /** An overload of findElement that delegates to the special implementation @@ -79,7 +79,7 @@ namespace mutablebson { /** A convenience wrapper around findElement<ElementType, FieldNameEquals>. */ template<typename ElementType> - inline ElementType findElementNamed(ElementType first, const StringData& fieldName) { + inline ElementType findElementNamed(ElementType first, StringData fieldName) { return findElement(first, FieldNameEquals(fieldName)); } @@ -103,7 +103,7 @@ namespace mutablebson { * Element is found, the returned Element's 'ok' method will return false. */ template<typename ElementType> - inline ElementType findFirstChildNamed(ElementType parent, const StringData& fieldName) { + inline ElementType findFirstChildNamed(ElementType parent, StringData fieldName) { return findFirstChild(parent, FieldNameEquals(fieldName)); } |