From 1d8edb214b1d3bd9f9be5613468dfd4792ae58d5 Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Tue, 14 Dec 2010 00:33:37 +0100
Subject: [PATCH] follow the switch to use shared_ptrs for sentence and chunk
 objects in corpus2

---
 libwccl/sentencecontext.cpp | 2 +-
 tests/datadriven.cpp        | 2 +-
 wcclparser/main.cpp         | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libwccl/sentencecontext.cpp b/libwccl/sentencecontext.cpp
index def13b5..9fd4b6f 100644
--- a/libwccl/sentencecontext.cpp
+++ b/libwccl/sentencecontext.cpp
@@ -10,7 +10,7 @@ SentenceContext::SentenceContext(const boost::shared_ptr<Corpus2::Sentence>& s)
 SentenceContext SentenceContext::duplicate() const
 {
 	SentenceContext dup(*this);
-	dup.sentence_.reset(sentence_->clone());
+	dup.sentence_ = sentence_->clone_shared();
 	return dup;
 }
 
diff --git a/tests/datadriven.cpp b/tests/datadriven.cpp
index 142ba20..3b2f276 100644
--- a/tests/datadriven.cpp
+++ b/tests/datadriven.cpp
@@ -66,7 +66,7 @@ void test_one_item_actual(const compare_test& c)
 	if (!sentence_filename.empty()) {
 		path sentence_fullpath = c.search_path / sentence_filename;
 		Corpus2::XcesReader reader(tagset, sentence_fullpath.string());
-		sentence.reset(reader.get_next_sentence());
+		sentence = reader.get_next_sentence();
 		BOOST_REQUIRE(sentence);
 	}
 	else {
diff --git a/wcclparser/main.cpp b/wcclparser/main.cpp
index cd00f57..4403c1a 100644
--- a/wcclparser/main.cpp
+++ b/wcclparser/main.cpp
@@ -8,6 +8,7 @@
 #include <libcorpus2/tagsetmanager.h>
 
 #include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
 #include <boost/program_options.hpp>
 #include <libcorpus2/io/xcesreader.h>
 
@@ -209,13 +210,13 @@ int main(int argc, char** argv)
 		const Corpus2::Tagset& tagset = Corpus2::get_named_tagset(tagset_load);
 		boost::shared_ptr<Corpus2::Sentence> sentence;
 		if (sentence_load.empty()) {
-			sentence.reset(new Corpus2::Sentence);
+			sentence = boost::make_shared<Corpus2::Sentence>();
 			sentence->append(new Corpus2::Token("", PwrNlp::Whitespace::ManySpaces));
 		} else {
 			std::ifstream ifs(sentence_load.c_str());
 			if (ifs.good()) {
 				Corpus2::XcesReader reader(tagset, ifs, false);
-				sentence.reset(reader.get_next_sentence());
+				sentence = reader.get_next_sentence();
 				std::cerr << "Sentence loaded, " << sentence->size()
 					<< " tokens.\n";
 			} else {
-- 
GitLab