Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pavel Zhukov
Kea
Commits
006424d3
Commit
006424d3
authored
Jan 20, 2011
by
hanfeng
Browse files
move the declear of find policy class above rbtree class declare
parent
1de3a156
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/rbtree.h
View file @
006424d3
...
...
@@ -239,6 +239,25 @@ template <typename T>
RBNode
<
T
>::~
RBNode
()
{
}
/// \brief search policy for rbtree which will affect the find function
/// behavior, depend on usage for rbtree, sometimes it needs return
/// empty node like using rbtree as zone data, the default search policy
/// for rbtree is ReturnNonEmptyNodePolicy.
/// \note to use policy class instead of just a bool variable to add to
/// the construction function of rbtree is considering the extendibility
/// also it is more clean use policy based programming which typically
/// use template class as the policy class
class
ReturnEmptyNodePolicy
{
public:
bool
returnEmptyNode
()
const
{
return
true
;
}
};
class
ReturnNonEmptyNodePolicy
{
public:
bool
returnEmptyNode
()
const
{
return
false
;
}
};
// note: the following class description is documented using multiline comments
// because the verbatim diagram contain a backslash, which could be interpreted
// as escape of newline in singleline comment.
...
...
@@ -299,12 +318,6 @@ RBNode<T>::~RBNode() {
* - since \c RBNode only has down pointer without up pointer, the node path
* during finding should be recorded for later use
*/
/// \brief forward declare search policy class, which will affect the behavior
/// of the find function in rbtree whether to return empty node
class
ReturnEmptyNodePolicy
;
class
ReturnNonEmptyNodePolicy
;
template
<
typename
T
,
typename
SearchPolicy
=
ReturnNonEmptyNodePolicy
>
class
RBTree
:
public
boost
::
noncopyable
,
public
SearchPolicy
{
friend
class
RBNode
<
T
>
;
...
...
@@ -912,24 +925,6 @@ RBTree<T,S>::indent(std::ostream& os, unsigned int depth) {
}
/// \brief search policy for rbtree which will affect the find function
/// behavior, depend on usage for rbtree, sometimes it needs return
/// empty node like using rbtree as zone data, the default search policy
/// for rbtree is ReturnNonEmptyNodePolicy.
/// \note to use policy class instead of just a bool variable to add to
/// the construction function of rbtree is considering the extendibility
/// also it is more clean use policy based programming which typically
/// use template class as the policy class
class
ReturnEmptyNodePolicy
{
public:
bool
returnEmptyNode
()
const
{
return
true
;
}
};
class
ReturnNonEmptyNodePolicy
{
public:
bool
returnEmptyNode
()
const
{
return
false
;
}
};
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment