diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-10 16:32:24 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-10 16:32:24 -0400 |
commit | 92d2eb957407c16d1eca3598e00e6c16cbe4e7e7 (patch) | |
tree | baea9d1514cd878a7cfe9396e497f7d08d134e0d /src/value.h | |
parent | 5659b6fb37b8601c39be6ecec3c8c86625686e0f (diff) | |
download | fork-ledger-92d2eb957407c16d1eca3598e00e6c16cbe4e7e7.tar.gz fork-ledger-92d2eb957407c16d1eca3598e00e6c16cbe4e7e7.tar.bz2 fork-ledger-92d2eb957407c16d1eca3598e00e6c16cbe4e7e7.zip |
Use ptr_deque for value_t::sequence_t
This is to work around undefined behavior according to the Standard,
[lib.res.on.functions]/2:
"In particular, the effects are undefined in the following cases: [..]
- if an incomplete type (3.9) is used as a template argument when
instantiating a template component."
Diffstat (limited to 'src/value.h')
-rw-r--r-- | src/value.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/value.h b/src/value.h index cb3b024a..ff8fe2b0 100644 --- a/src/value.h +++ b/src/value.h @@ -88,7 +88,7 @@ public: * The sequence_t member type abstracts the type used to represent a * resizable "array" of value_t objects. */ - typedef std::deque<value_t> sequence_t; + typedef ptr_deque<value_t> sequence_t; typedef sequence_t::iterator iterator; typedef sequence_t::const_iterator const_iterator; typedef sequence_t::difference_type difference_type; @@ -836,7 +836,7 @@ public: *this = sequence_t(); if (! is_sequence()) in_place_cast(SEQUENCE); - as_sequence_lval().push_front(val); + as_sequence_lval().push_front(new value_t(val)); } void push_back(const value_t& val) { @@ -844,7 +844,7 @@ public: *this = sequence_t(); if (! is_sequence()) in_place_cast(SEQUENCE); - as_sequence_lval().push_back(val); + as_sequence_lval().push_back(new value_t(val)); } void pop_back() { |