diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-20 16:55:51 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-20 16:55:51 +0100 |
commit | 42e2402efb8840ee72d145ac3df8a06ccc8f5c7f (patch) | |
tree | 1ccb3eaea273f77931fa671549c092ef47a1e569 | |
parent | 4bd9e7af0ab86adc09d449603158c8bc43d7103c (diff) |
removed unique_ptr because client applications do not allow unique_ptr with unknown types
-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); } /** |