[gnote] Use std::make_shared in Trie
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use std::make_shared in Trie
- Date: Thu, 26 Dec 2019 13:58:49 +0000 (UTC)
commit 04aa48bbadfcd448f381720c3a0c5c6675598575
Author: Aurimas Černius <aurisc4 gmail com>
Date: Thu Dec 26 15:44:29 2019 +0200
Use std::make_shared in Trie
src/trie.hpp | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/src/trie.hpp b/src/trie.hpp
index db235f97..c0cfb87b 100644
--- a/src/trie.hpp
+++ b/src/trie.hpp
@@ -215,8 +215,7 @@ public:
typename TrieHit<value_t>::ListPtr find_matches (const Glib::ustring & haystack)
{
TrieStatePtr current_state = m_root;
- typename TrieHit<value_t>::ListPtr matches(
- new typename TrieHit<value_t>::List());
+ auto matches = std::make_shared<typename TrieHit<value_t>::List>();
int start_index = 0;
Glib::ustring::const_iterator haystack_iter = haystack.begin();
@@ -248,11 +247,7 @@ public:
// string and the payload object
if (current_state->payload_present()) {
int hit_length = i - start_index + 1;
- typename TrieHit<value_t>::Ptr hit(
- new TrieHit<value_t>(start_index,
- start_index + hit_length,
- haystack.substr(start_index, hit_length),
- current_state->payload()));
+ auto hit = std::make_shared<TrieHit<value_t>>(start_index, start_index + hit_length,
haystack.substr(start_index, hit_length), current_state->payload());
matches->push_back(hit);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]