diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-01-09 16:04:48 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-01-09 16:04:48 +0100 |
commit | fe176939a2915d39984197cb4e03988a8386a378 (patch) | |
tree | 39509672b0dbd117bc9a7d3469a99ba3663b6670 /searchlib | |
parent | a0f3245ed6794deb3c6c203f2e1d9a81ad7335b5 (diff) |
- Be explicit about std::make_unique
- Instead of abort, just let dynamic_cast do the dirty stuff for you. It will also provide better information.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp index ba48dc7781a..1c4e07e38ee 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp @@ -14,7 +14,6 @@ using vespalib::tensor::DenseTensor; using vespalib::tensor::DenseTensorView; using vespalib::tensor::MutableDenseTensorView; using vespalib::eval::ValueType; -using std::make_unique; namespace search::tensor { @@ -175,9 +174,9 @@ DenseTensorStore::getTensor(EntryRef ref) const auto raw = getRawBuffer(ref); size_t numCells = getNumCells(raw); if (_numUnboundDims == 0) { - return make_unique<DenseTensorView>(_type, CellsRef(static_cast<const double *>(raw), numCells)); + return std::make_unique<DenseTensorView>(_type, CellsRef(static_cast<const double *>(raw), numCells)); } else { - auto result = make_unique<MutableDenseTensorView>(_type, CellsRef(static_cast<const double *>(raw), numCells)); + auto result = std::make_unique<MutableDenseTensorView>(_type, CellsRef(static_cast<const double *>(raw), numCells)); makeConcreteType(*result, raw, _numUnboundDims); return result; } @@ -262,11 +261,8 @@ DenseTensorStore::setDenseTensor(const TensorType &tensor) TensorStore::EntryRef DenseTensorStore::setTensor(const Tensor &tensor) { - const DenseTensorView *view(dynamic_cast<const DenseTensorView *>(&tensor)); - if (view) { - return setDenseTensor(*view); - } - abort(); + const DenseTensorView &view(dynamic_cast<const DenseTensorView &>(tensor)); + return setDenseTensor(view); } } |