summaryrefslogtreecommitdiff
path: root/src/value.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-04 20:07:44 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-04 20:40:45 -0500
commit4a14f3224b9063202ca39a67c9aff42ae4274942 (patch)
tree2b4f556ea845debe967c0f4b7c5d7782961fdccb /src/value.h
parentb14c814fec11ab450c552bccf5fe7d96dc2c4e18 (diff)
downloadfork-ledger-4a14f3224b9063202ca39a67c9aff42ae4274942.tar.gz
fork-ledger-4a14f3224b9063202ca39a67c9aff42ae4274942.tar.bz2
fork-ledger-4a14f3224b9063202ca39a67c9aff42ae4274942.zip
Added value_t::push_front
Diffstat (limited to 'src/value.h')
-rw-r--r--src/value.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/value.h b/src/value.h
index a0bb533d..0993305e 100644
--- a/src/value.h
+++ b/src/value.h
@@ -87,7 +87,7 @@ public:
* The sequence_t member type abstracts the type used to represent a
* resizable "array" of value_t objects.
*/
- typedef std::vector<value_t> sequence_t;
+ typedef std::deque<value_t> sequence_t;
typedef sequence_t::iterator iterator;
typedef sequence_t::const_iterator const_iterator;
typedef sequence_t::difference_type difference_type;
@@ -800,6 +800,14 @@ public:
return null;
}
+ void push_front(const value_t& val) {
+ if (is_null())
+ *this = sequence_t();
+ if (! is_sequence())
+ in_place_cast(SEQUENCE);
+ as_sequence_lval().push_front(val);
+ }
+
void push_back(const value_t& val) {
if (is_null())
*this = sequence_t();