Skip to content
Snippets Groups Projects
Commit 455f2a2c authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

fixed next_document in Cropus

parent cd5e51ab
No related merge requests found
...@@ -21,7 +21,7 @@ namespace whole{ ...@@ -21,7 +21,7 @@ namespace whole{
Corpus::Corpus(const std::string name) : name_(name), documents_() Corpus::Corpus(const std::string name) : name_(name), documents_()
{ {
this->current_document_ = documents_.begin(); set_ = false;
} }
} // whole ns } // whole ns
......
...@@ -49,12 +49,22 @@ public: ...@@ -49,12 +49,22 @@ public:
} }
/// Next document in corpus /// Next document in corpus
/// @todo I don't know if it'll be working... It should be tested!
boost::shared_ptr<Document> next_document() { boost::shared_ptr<Document> next_document() {
return *(current_document_++); if (!this->set_) {
this->set_ = true;
this->current_document_ = documents_.begin();
}
else {
current_document_++;
}
return *current_document_;
} }
private: private:
bool set_;
/// Corpus name /// Corpus name
const std::string name_; const std::string name_;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment