diff options
-rw-r--r-- | include/valueiterator.h | 4 | ||||
-rw-r--r-- | src/iteratorimpl.h | 10 | ||||
-rw-r--r-- | src/valueiterator.cpp | 13 |
3 files changed, 23 insertions, 4 deletions
diff --git a/include/valueiterator.h b/include/valueiterator.h index 00ecc39..fd8118d 100644 --- a/include/valueiterator.h +++ b/include/valueiterator.h @@ -48,7 +48,7 @@ public: /** * Destructor */ - virtual ~ValueIterator() {} + virtual ~ValueIterator(); /** * Increment position (pre-increment) @@ -125,7 +125,7 @@ private: * Pointer to the actual implementation * @var std::unique_ptr */ - std::unique_ptr<IteratorImpl> _impl; + IteratorImpl *_impl; }; diff --git a/src/iteratorimpl.h b/src/iteratorimpl.h index 4d15c73..a88282a 100644 --- a/src/iteratorimpl.h +++ b/src/iteratorimpl.h @@ -21,6 +21,16 @@ class IteratorImpl { public: /** + * Constructor + */ + IteratorImpl() {} + + /** + * Destructor + */ + virtual ~IteratorImpl() {} + + /** * Clone the object * @return IteratorImpl* */ diff --git a/src/valueiterator.cpp b/src/valueiterator.cpp index 92a2542..c43fbbb 100644 --- a/src/valueiterator.cpp +++ b/src/valueiterator.cpp @@ -20,6 +20,15 @@ namespace Php { ValueIterator::ValueIterator(const ValueIterator &that) : _impl(that._impl->clone()) {} /** + * Destructor + */ +ValueIterator::~ValueIterator() +{ + // get rid of implementation + delete _impl; +} + +/** * Increment position * @return ValueIterator */ @@ -52,7 +61,7 @@ ValueIterator &ValueIterator::operator--() */ bool ValueIterator::operator==(const ValueIterator &that) const { - return _impl->equals(that._impl.get()); + return _impl->equals(that._impl); } /** @@ -62,7 +71,7 @@ bool ValueIterator::operator==(const ValueIterator &that) const */ bool ValueIterator::operator!=(const ValueIterator &that) const { - return !_impl->equals(that._impl.get()); + return !_impl->equals(that._impl); } /** |