summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhoffert <jhoffert@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-01-10 15:55:52 +0000
committerjhoffert <jhoffert@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-01-10 15:55:52 +0000
commit4d7819d8a93bdefa24c0685d25ab42a687ca10cc (patch)
tree6d46cf30a4e5db24c8675b143180258ed994982d
parentb437d27d5b209f18118eea10528441af84ff515e (diff)
downloadATCD-4d7819d8a93bdefa24c0685d25ab42a687ca10cc.tar.gz
Fixed error leaks with bracket operator on iterators
-rw-r--r--TAO/tao/Unbounded_Basic_String_Sequence_T.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/TAO/tao/Unbounded_Basic_String_Sequence_T.h b/TAO/tao/Unbounded_Basic_String_Sequence_T.h
index fa187be0c38..20b6b3d30d8 100644
--- a/TAO/tao/Unbounded_Basic_String_Sequence_T.h
+++ b/TAO/tao/Unbounded_Basic_String_Sequence_T.h
@@ -306,15 +306,6 @@ public:
this->sequence_->release ());
}
- /// @copydoc details::generic_sequence::operator[]
- //inline const_element_type operator[](CORBA::ULong i) const {
- // return const_element_type (impl_[i], release());
- //}
- /// @copydoc details::generic_sequence::operator[]
- //inline element_type operator[](CORBA::ULong i) {
- // return element_type(impl_[i], release());
- //}
-
/// Returns a const reference to the item contained at the current position
//const value_type & operator* (void) const
const_element_type operator* (void) const
@@ -408,12 +399,20 @@ public:
return this->pos_ - rhs.pos_;
}
+ /// Element operator/assignment
+ element_type operator[] (difference_type n)
+ {
+ // Return the element at position pos_ + n
+ return element_type ((*(this->sequence_))[this->pos_ + n],
+ this->sequence_->release ());
+ }
/// Element operator/assignment
- value_type & operator[] (difference_type n)
+ const_element_type operator[] (difference_type n) const
{
- // Return the element at position n
- return (*(this->sequence_))[this->pos_ + n];
+ // Return the element at position pos_ + n
+ return const_element_type ((*(this->sequence_))[this->pos_ + n],
+ this->sequence_->release ());
}
/// Less than
@@ -632,11 +631,12 @@ public:
return this->pos_ - rhs.pos_;
}
- /// Element operator/assignment
- const value_type & operator[] (difference_type n) const
+ /// Element operator
+ const_element_type operator[] (difference_type n) const
{
- // Return the element at position n
- return (*(this->sequence_))[this->pos_ + n];
+ // Return the element at position pos_ + n
+ return const_element_type ((*(this->sequence_))[this->pos_ + n],
+ this->sequence_->release ());
}
/// Less than
@@ -850,12 +850,20 @@ public:
return rhs.pos_ - this->pos_;
}
+ /// Element operator/assignment
+ element_type operator[] (difference_type n)
+ {
+ // Return the element at position pos_ + n
+ return element_type ((*(this->sequence_))[this->pos_ + n],
+ this->sequence_->release ());
+ }
/// Element operator/assignment
- value_type & operator[] (difference_type n)
+ const_element_type operator[] (difference_type n) const
{
- // Return the element at position n
- return (*(this->sequence_))[this->pos_ - n];
+ // Return the element at position pos_ + n
+ return const_element_type ((*(this->sequence_))[this->pos_ + n],
+ this->sequence_->release ());
}
/// Less than
@@ -1091,10 +1099,11 @@ public:
}
/// Element operator/assignment
- const value_type & operator[] (difference_type n) const
+ const_element_type operator[] (difference_type n) const
{
- // Return the element at position n
- return (*(this->sequence_))[this->pos_ - n];
+ // Return the element at position pos_ + n
+ return const_element_type ((*(this->sequence_))[this->pos_ + n],
+ this->sequence_->release ());
}
/// Less than