diff options
-rw-r--r-- | src/py_value.cc | 6 | ||||
-rw-r--r-- | src/system.hh.in | 1 | ||||
-rw-r--r-- | src/value.cc | 6 | ||||
-rw-r--r-- | src/value.h | 6 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/py_value.cc b/src/py_value.cc index 46fa94c3..dabda427 100644 --- a/src/py_value.cc +++ b/src/py_value.cc @@ -352,9 +352,13 @@ void export_value() .def("basetype", py_base_type) ; +#if 0 + // jww (2010-06-10): This is not working since I switched sequence_t to + // ptr_deque<value_t>. class_< value_t::sequence_t > ("ValueSequence") - .def(vector_indexing_suite< value_t::sequence_t >()); + .def(vector_indexing_suite< value_t::sequence_t, true >()); ; +#endif scope().attr("NULL_VALUE") = NULL_VALUE; scope().attr("string_value") = &string_value; diff --git a/src/system.hh.in b/src/system.hh.in index 5de7150e..ff59221e 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -159,6 +159,7 @@ typedef std::ostream::pos_type ostream_pos_type; #include <boost/operators.hpp> #include <boost/optional.hpp> #include <boost/ptr_container/ptr_list.hpp> +#include <boost/ptr_container/ptr_deque.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_int.hpp> #include <boost/random/uniform_real.hpp> diff --git a/src/value.cc b/src/value.cc index 33461c5a..74dd843d 100644 --- a/src/value.cc +++ b/src/value.cc @@ -343,7 +343,7 @@ value_t& value_t::operator+=(const value_t& val) throw_(value_error, _("Cannot add sequences of different lengths")); } } else { - as_sequence_lval().push_back(val); + as_sequence_lval().push_back(new value_t(val)); } return *this; } @@ -1110,7 +1110,7 @@ void value_t::in_place_cast(type_t cast_type) else if (cast_type == SEQUENCE) { sequence_t temp; if (! is_null()) - temp.push_back(*this); + temp.push_back(new value_t(*this)); set_sequence(temp); return; } @@ -1693,7 +1693,7 @@ value_t value_t::strip_annotations(const keep_details_t& what_to_keep) const case SEQUENCE: { sequence_t temp; foreach (const value_t& value, as_sequence()) - temp.push_back(value.strip_annotations(what_to_keep)); + temp.push_back(new value_t(value.strip_annotations(what_to_keep))); return temp; } 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() { |