From e50d759501c0a085a2cabc8c2f99d306a68a4b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Sun, 15 Feb 2015 20:00:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E5=90=8D=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Detail/TireTree.cpp | 8 ++++---- TinySTL/TrieTree.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TinySTL/Detail/TireTree.cpp b/TinySTL/Detail/TireTree.cpp index fdf84e0..2ff57f1 100644 --- a/TinySTL/Detail/TireTree.cpp +++ b/TinySTL/Detail/TireTree.cpp @@ -1,11 +1,11 @@ #include "../TrieTree.h" namespace TinySTL{ - trie_tree::trie_tree():data(new trie_node), size_(0){} + trie_tree::trie_tree() :root_(new trie_node), size_(0){} trie_tree::~trie_tree(){ - if (data){ - data->map_childs.clear(); - delete data; + if (root_){ + root_->map_childs.clear(); + delete root_; } } bool trie_tree::empty()const{ diff --git a/TinySTL/TrieTree.h b/TinySTL/TrieTree.h index 5f2bf3d..e91f859 100644 --- a/TinySTL/TrieTree.h +++ b/TinySTL/TrieTree.h @@ -24,7 +24,7 @@ namespace TinySTL{ typedef string value_type; typedef size_t size_type; private: - trie_node *data; + trie_node *root_; size_type size_; public: trie_tree(); @@ -41,7 +41,7 @@ namespace TinySTL{ bool is_existed(const string& word)const; private: node_ptr make_node(char ch, bool is_a_word); - inline trie_node* get_root()const{ return data; } + inline trie_node* get_root()const{ return root_; } void _get_word_by_prefix(const string& prefix, const node_ptr& up, const string& real_prefix, vector& words)const; void __get_word_by_prefix(const node_ptr& up, string& word, const string& prefix, vector& words)const; void _print_tree(std::ostream& os, const node_ptr& up, string word)const; -- GitLab