summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-10-24 12:17:42 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-10-24 13:02:29 +0000
commitfd7bcad66aa02af82b42a36a763e52fe10b83241 (patch)
tree1cc4efe767cfcee584a831ded24c394b187107fe /eval
parent426de78104945cedfe35198955f13a7dde4e3580 (diff)
ValueType copy constructor/operator
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/eval/value_builder_factory.h6
-rw-r--r--eval/src/vespa/eval/eval/value_type.cpp7
-rw-r--r--eval/src/vespa/eval/eval/value_type.h6
3 files changed, 11 insertions, 8 deletions
diff --git a/eval/src/vespa/eval/eval/value_builder_factory.h b/eval/src/vespa/eval/eval/value_builder_factory.h
index a0266956f80..8f4a10b7281 100644
--- a/eval/src/vespa/eval/eval/value_builder_factory.h
+++ b/eval/src/vespa/eval/eval/value_builder_factory.h
@@ -11,7 +11,7 @@ namespace vespalib::eval {
* downcasting to actual builder with specialized cell type.
**/
struct ValueBuilderBase {
- virtual ~ValueBuilderBase() {}
+ virtual ~ValueBuilderBase() = default;
};
/**
@@ -59,7 +59,7 @@ private:
{
assert(check_cell_type<T>(type.cell_type()));
auto base = create_value_builder_base(type, transient, num_mapped_dims_in, subspace_size_in, expected_subspaces);
- ValueBuilder<T> *builder = static_cast<ValueBuilder<T>*>(base.get());
+ auto *builder = static_cast<ValueBuilder<T>*>(base.get());
base.release();
return std::unique_ptr<ValueBuilder<T>>(builder);
}
@@ -82,7 +82,7 @@ public:
return create_value_builder<T>(type, false, type.count_mapped_dimensions(), type.dense_subspace_size(), 1);
}
std::unique_ptr<Value> copy(const Value &value) const;
- virtual ~ValueBuilderFactory() {}
+ virtual ~ValueBuilderFactory() = default;
protected:
virtual std::unique_ptr<ValueBuilderBase> create_value_builder_base(const ValueType &type, bool transient,
size_t num_mapped_dims_in, size_t subspace_size_in, size_t expected_subspaces) const = 0;
diff --git a/eval/src/vespa/eval/eval/value_type.cpp b/eval/src/vespa/eval/eval/value_type.cpp
index cda72acbc34..1a83de9b0f9 100644
--- a/eval/src/vespa/eval/eval/value_type.cpp
+++ b/eval/src/vespa/eval/eval/value_type.cpp
@@ -71,7 +71,7 @@ struct MyJoin {
vespalib::string concat_dim;
MyJoin(const DimensionList &lhs, const DimensionList &rhs)
: mismatch(false), dimensions(), concat_dim() { my_join(lhs, rhs); }
- MyJoin(const DimensionList &lhs, const DimensionList &rhs, vespalib::string concat_dim_in)
+ MyJoin(const DimensionList &lhs, const DimensionList &rhs, const vespalib::string & concat_dim_in)
: mismatch(false), dimensions(), concat_dim(concat_dim_in) { my_join(lhs, rhs); }
~MyJoin();
private:
@@ -152,6 +152,8 @@ ValueType::error_if(bool has_error, ValueType else_type)
}
}
+ValueType::ValueType(const ValueType &) = default;
+ValueType & ValueType::operator =(const ValueType &) = default;
ValueType::~ValueType() = default;
bool
@@ -302,6 +304,7 @@ std::vector<vespalib::string>
ValueType::dimension_names() const
{
std::vector<vespalib::string> result;
+ result.reserve(_dimensions.size());
for (const auto &dimension: _dimensions) {
result.push_back(dimension.name);
}
@@ -367,7 +370,7 @@ ValueType::make_type(CellType cell_type, std::vector<Dimension> dimensions_in)
if (!verify_dimensions(dimensions_in)) {
return error_type();
}
- return ValueType(cell_type, std::move(dimensions_in));
+ return {cell_type, std::move(dimensions_in)};
}
ValueType
diff --git a/eval/src/vespa/eval/eval/value_type.h b/eval/src/vespa/eval/eval/value_type.h
index 99cc61c0af1..b35e23ee4e6 100644
--- a/eval/src/vespa/eval/eval/value_type.h
+++ b/eval/src/vespa/eval/eval/value_type.h
@@ -49,9 +49,9 @@ private:
public:
ValueType(ValueType &&) noexcept = default;
- ValueType(const ValueType &) = default;
+ ValueType(const ValueType &);
ValueType &operator=(ValueType &&) noexcept = default;
- ValueType &operator=(const ValueType &) = default;
+ ValueType &operator=(const ValueType &);
~ValueType();
CellType cell_type() const { return _cell_type; }
CellMeta cell_meta() const { return {_cell_type, is_double()}; }
@@ -88,7 +88,7 @@ public:
const std::vector<vespalib::string> &to) const;
ValueType cell_cast(CellType to_cell_type) const;
- static ValueType error_type() { return ValueType(); }
+ static ValueType error_type() { return {}; }
static ValueType make_type(CellType cell_type, std::vector<Dimension> dimensions_in);
static ValueType double_type() { return make_type(CellType::DOUBLE, {}); }
static ValueType from_spec(const vespalib::string &spec);