From 1607527a9cbd8c80a6e8f6a8d71bc0dd009889ce Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 12 Nov 2019 11:48:32 +0000 Subject: Use std::make_unique --- document/src/vespa/document/select/value.h | 14 +++++++------- document/src/vespa/document/select/valuenodes.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'document') diff --git a/document/src/vespa/document/select/value.h b/document/src/vespa/document/select/value.h index c21e1a96470..a7f3abef81a 100644 --- a/document/src/vespa/document/select/value.h +++ b/document/src/vespa/document/select/value.h @@ -68,7 +68,7 @@ public: ResultList operator<(const Value&) const override; ResultList operator==(const Value&) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const override { return Value::UP(new InvalidValue()); } + Value::UP clone() const override { return std::make_unique(); } }; class NullValue : public Value @@ -82,7 +82,7 @@ public: ResultList operator>=(const Value &) const override; ResultList operator<=(const Value &) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const override { return Value::UP(new NullValue()); } + Value::UP clone() const override { return std::make_unique(); } }; class StringValue : public Value @@ -96,7 +96,7 @@ public: ResultList operator<(const Value& value) const override; ResultList operator==(const Value& value) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const override { return Value::UP(new StringValue(_value)); } + Value::UP clone() const override { return std::make_unique(_value); } }; class IntegerValue; @@ -139,7 +139,7 @@ public: void print(std::ostream& out, bool verbose, const std::string& indent) const override; Value::UP clone() const override { - return Value::UP(new IntegerValue(_value, getType() == Value::Bucket)); + return std::make_unique(_value, getType() == Value::Bucket); } private: ValueType _value; @@ -164,7 +164,7 @@ public: ResultList operator==(const FloatValue& value) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const override { return Value::UP(new FloatValue(_value)); } + Value::UP clone() const override { return std::make_unique(_value); } private: ValueType _value; }; @@ -210,7 +210,7 @@ public: template ResultList doCompare(const Value& value, const Predicate& cmp) const; - Value::UP clone() const override { return Value::UP(new ArrayValue(_values)); } + Value::UP clone() const override { return std::make_unique(_values); } private: struct EqualsComparator; @@ -235,7 +235,7 @@ public: ResultList operator==(const Value& value) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const override { return Value::UP(new StructValue(_values)); } + Value::UP clone() const override { return std::make_unique(_values); } private: ValueMap _values; }; diff --git a/document/src/vespa/document/select/valuenodes.h b/document/src/vespa/document/select/valuenodes.h index 4ddbee16f8c..02079c0b5df 100644 --- a/document/src/vespa/document/select/valuenodes.h +++ b/document/src/vespa/document/select/valuenodes.h @@ -22,7 +22,7 @@ public: InvalidValueNode(vespalib::stringref name); std::unique_ptr getValue(const Context&) const override { - return std::unique_ptr(new InvalidValue()); + return std::make_unique(); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -39,7 +39,7 @@ public: NullValueNode(); std::unique_ptr getValue(const Context&) const override { - return std::unique_ptr(new NullValue()); + return std::make_unique(); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -60,7 +60,7 @@ public: const vespalib::string& getValue() const { return _value; } std::unique_ptr getValue(const Context&) const override { - return std::unique_ptr(new StringValue(_value)); + return std::make_unique(_value); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -81,8 +81,8 @@ public: int64_t getValue() const { return _value; } - virtual std::unique_ptr getValue(const Context&) const override { - return std::unique_ptr(new IntegerValue(_value, _isBucketValue)); + std::unique_ptr getValue(const Context&) const override { + return std::make_unique(_value, _isBucketValue); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -99,7 +99,7 @@ public: int64_t getValue() const; std::unique_ptr getValue(const Context&) const override { - return std::unique_ptr(new IntegerValue(getValue(), false)); + return std::make_unique(getValue(), false); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -137,7 +137,7 @@ public: double getValue() const { return _value; } std::unique_ptr getValue(const Context&) const override { - return std::unique_ptr(new FloatValue(_value)); + return std::make_unique(_value); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; -- cgit v1.2.3