Commit c73a307c authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac517] make RBTreeNodeChain non copyable

In the latest usage we don't need to copy RBTreeNodeChain objects.
It would be safer to disable copy unless/until we see need for it.
parent 1a52db43
......@@ -314,35 +314,23 @@ class RBTreeNodeChain {
public:
/// \name Constructors and Assignment Operator.
///
/// \note The copy constructor and the assignment operator are
/// intentionally defined as private, making this class non copyable.
/// This may have to be changed in a future version with newer need.
/// For now we explicitly disable copy to avoid accidental copy happens
/// unintentionally.
//{@
/// The default constructor.
///
/// \exception None
RBTreeNodeChain() : node_count_(0) {}
/// Copy constructor.
///
/// \exception None
RBTreeNodeChain(const RBTreeNodeChain<T>& node_path) {
node_count_ = node_path.node_count_;
if (node_count_ > 0) {
memcpy(nodes_, node_path.nodes_, node_count_ * sizeof(RBNode<T>*));
}
}
/// Assignment operator.
///
/// \exception None
RBTreeNodeChain<T>&
operator=(const RBTreeNodeChain<T>& node_path) {
node_count_ = node_path.node_count_;
if (node_count_ > 0) {
memcpy(nodes_, node_path.nodes_, node_count_ * sizeof(RBNode<T>*));
}
return (*this);
}
private:
RBTreeNodeChain(const RBTreeNodeChain<T>&);
RBTreeNodeChain<T>& operator=(const RBTreeNodeChain<T>&);
//@}
public:
/// \brief Return the number of levels stored in the chain.
///
/// It's equal to the number of nodes in the chain; for an empty
......
Supports Markdown
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