Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-10-17 16:50:08 +0400
committerKenneth Heafield <github@kheafield.com>2012-10-17 16:50:08 +0400
commit8f4305e12ff90f2deb6530f09bb5861302a23d57 (patch)
treeca4297de93cf9aa5531230a4991a25aeb61b3d4f /search/vertex.hh
parent4cf1ffb7d803710a2a2bbaab84c42e42b1b175a1 (diff)
Allocate less, switch to existing being continuation
Diffstat (limited to 'search/vertex.hh')
-rw-r--r--search/vertex.hh19
1 files changed, 11 insertions, 8 deletions
diff --git a/search/vertex.hh b/search/vertex.hh
index 4ccb24713..1cdcae30d 100644
--- a/search/vertex.hh
+++ b/search/vertex.hh
@@ -105,16 +105,20 @@ class PartialVertex {
return index_ + 1 < back_->Size();
}
- // Split into continuation and alternative, rendering this the alternative.
- bool Split(PartialVertex &continuation) {
+ // Split into continuation and alternative, rendering this the continuation.
+ bool Split(PartialVertex &alternative) {
assert(!Complete());
- continuation.back_ = &((*back_)[index_]);
- continuation.index_ = 0;
+ bool ret;
if (index_ + 1 < back_->Size()) {
- ++index_;
- return true;
+ alternative.index_ = index_ + 1;
+ alternative.back_ = back_;
+ ret = true;
+ } else {
+ ret = false;
}
- return false;
+ back_ = &((*back_)[index_]);
+ index_ = 0;
+ return ret;
}
const Final &End() const {
@@ -140,7 +144,6 @@ class Vertex {
PartialVertex continuation;
while (!top.Complete()) {
top.Split(continuation);
- top = continuation;
}
return &top.End();
}