aboutsummaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-15 13:16:59 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-15 13:16:59 +0000
commit4fc817362cec192ba78be3216503ee9c03a60954 (patch)
tree74fea7ac33902aee54793c5ccf4aae946d14ea2f /searchcorespi
parentf6712d97f2b06cc8717911a93b2ff66c6c2953a8 (diff)
std::make_unique while reading up on phrase search code.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp
index 81a43f932ca..b71927c714f 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp
@@ -34,7 +34,7 @@ IndexCollection::IndexCollection(const ISourceSelector::SP & selector,
setCurrentIndex(sources.getCurrentIndex());
}
-IndexCollection::~IndexCollection() {}
+IndexCollection::~IndexCollection() = default;
void
IndexCollection::setSource(uint32_t docId)
@@ -49,12 +49,11 @@ IndexCollection::replaceAndRenumber(const ISourceSelector::SP & selector,
uint32_t id_diff,
const IndexSearchable::SP &new_source)
{
- ISearchableIndexCollection::UP new_fsc(new IndexCollection(selector));
+ auto new_fsc = std::make_unique<IndexCollection>(selector);
new_fsc->append(0, new_source);
for (size_t i = 0; i < fsc.getSourceCount(); ++i) {
if (fsc.getSourceId(i) > id_diff) {
- new_fsc->append(fsc.getSourceId(i) - id_diff,
- fsc.getSearchableSP(i));
+ new_fsc->append(fsc.getSourceId(i) - id_diff, fsc.getSearchableSP(i));
}
}
return new_fsc;
@@ -148,17 +147,17 @@ struct Mixer {
: _selector(selector), _blender() {}
void addIndex(Blueprint::UP index) {
- if (_blender.get() == NULL) {
- _blender.reset(new SourceBlenderBlueprint(_selector));
+ if ( ! _blender) {
+ _blender = std::make_unique<SourceBlenderBlueprint>(_selector);
}
_blender->addChild(std::move(index));
}
Blueprint::UP mix() {
- if (_blender.get() == NULL) {
- return Blueprint::UP(new EmptyBlueprint());
+ if (_blender) {
+ return std::move(_blender);
}
- return Blueprint::UP(_blender.release());
+ return std::make_unique<EmptyBlueprint>();
}
};