senf::PacketInterpreterBase::ptr pi2 (senf::PacketInterpreter<VoidPacket>::create(
MyListBParser::init_bytes));
MyListBParser::container c2 (MyListBParser(pi2->data().begin(),&pi2->data()));
- c2.push_back_space();
{
- VectorParser::vec_t::container c2v (c2.front().vec());
+ VectorParser::vec_t::container c2v (c2.push_back_space().vec());
c2v.push_back(0x2345u);
c2v.push_back(0x3456u);
}
}
template <class ListPolicy>
-prefix_ void senf::ListParser_Container<ListPolicy>::shift(iterator pos, size_type n)
+prefix_ typename senf::ListParser_Container<ListPolicy>::value_type
+senf::ListParser_Container<ListPolicy>::shift(iterator pos, size_type n)
{
ListPolicy::update(*this);
safe_data_iterator sp (data(),pos.raw());
value_type(sp,state()).init();
ListPolicy::insert(*this,sp);
}
+ return value_type(sp,state());
}
template <class ListPolicy>
}
template <class ListPolicy>
-prefix_ void senf::ListParser<ListPolicy>::push_back_space(size_type n)
+prefix_ typename senf::ListParser<ListPolicy>::value_type
+senf::ListParser<ListPolicy>::push_back_space(size_type n)
const
{
container c(*this);
- c.push_back_space(n);
+ return c.push_back_space(n);
}
template <class ListPolicy>
}
template <class ListPolicy>
-prefix_ void senf::ListParser<ListPolicy>::push_front_space(size_type n)
+prefix_ typename senf::ListParser<ListPolicy>::value_type
+senf::ListParser<ListPolicy>::push_front_space(size_type n)
const
{
container c(*this);
- c.push_front_space(n);
+ return c.push_front_space(n);
}
template <class ListPolicy>
}
template <class ListPolicy>
-prefix_ void senf::ListParser_Container<ListPolicy>::push_back_space(size_type n)
+prefix_ typename senf::ListParser_Container<ListPolicy>::value_type
+senf::ListParser_Container<ListPolicy>::push_back_space(size_type n)
{
- shift(end(),n);
+ return shift(end(),n);
}
template <class ListPolicy>
}
template <class ListPolicy>
-prefix_ void senf::ListParser_Container<ListPolicy>::push_front_space(size_type n)
+prefix_ typename senf::ListParser_Container<ListPolicy>::value_type
+senf::ListParser_Container<ListPolicy>::push_front_space(size_type n)
{
- shift(begin(),n);
+ return shift(begin(),n);
}
// Parser interface
value_type back() const;
template <class Value> void push_back (Value const & value, size_type n=1) const;
- void push_back_space (size_type n=1) const;
+ value_type push_back_space (size_type n=1) const;
template <class Value> void push_front (Value const & value, size_type n=1) const;
- void push_front_space (size_type n=1) const;
+ value_type push_front_space (size_type n=1) const;
void resize (size_type n) const;
template <class Value> void resize (size_type n, Value value) const;
///@{
// All these operations can be quite inefficient depending on the list type
- void shift(iterator pos, size_type n=1);
+ value_type shift(iterator pos, size_type n=1);
template <class Value>
void insert(iterator pos, Value const & t);
template <class Value>
void clear();
template <class Value> void push_back (Value const & value, size_type n=1);
- void push_back_space (size_type n=1);
+ value_type push_back_space (size_type n=1);
template <class Value> void push_front (Value const & value, size_type n=1);
- void push_front_space (size_type n=1);
- void resize (size_type n);
+ value_type push_front_space (size_type n=1);
+ void resize (size_type n);
template <class Value> void resize (size_type n, Value value);
///@}
}
template <class ElementParser, class AuxPolicy>
-prefix_ void senf::VectorParser<ElementParser,AuxPolicy>::push_back_space(size_type n)
+prefix_ typename senf::VectorParser<ElementParser,AuxPolicy>::value_type
+senf::VectorParser<ElementParser,AuxPolicy>::push_back_space(size_type n)
const
{
container c (*this);
- c.push_back_space(n);
+ return c.push_back_space(n);
}
template <class ElementParser, class AuxPolicy>
}
template <class ElementParser, class AuxPolicy>
-prefix_ void senf::VectorParser<ElementParser,AuxPolicy>::push_front_space(size_type n)
+prefix_ typename senf::VectorParser<ElementParser,AuxPolicy>::value_type
+senf::VectorParser<ElementParser,AuxPolicy>::push_front_space(size_type n)
const
{
container c (*this);
- c.push_front_space(n);
+ return c.push_front_space(n);
}
template <class ElementParser, class AuxPolicy>
}
template <class ElementParser, class AuxPolicy>
-prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::push_back_space(size_type n)
+prefix_ typename senf::VectorParser_Container<ElementParser,AuxPolicy>::value_type
+senf::VectorParser_Container<ElementParser,AuxPolicy>::push_back_space(size_type n)
{
- shift(end(),n);
+ return *shift(end(),n);
}
template <class ElementParser, class AuxPolicy>
}
template <class ElementParser, class AuxPolicy>
-prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::push_front_space(size_type n)
+prefix_ typename senf::VectorParser_Container<ElementParser,AuxPolicy>::value_type
+senf::VectorParser_Container<ElementParser,AuxPolicy>::push_front_space(size_type n)
{
- shift(begin(),n);
+ return *shift(begin(),n);
}
// Parser interface
// 'container' wrapper
template <class Value> void push_back (Value const & value, size_type n=1) const;
- void push_back_space (size_type n=1) const;
+ value_type push_back_space (size_type n=1) const;
template <class Value> void push_front (Value const & value, size_type n=1) const;
- void push_front_space (size_type n=1) const;
- void resize (size_type n) const;
+ value_type push_front_space (size_type n=1) const;
+ void resize (size_type n) const;
template <class Value> void resize (size_type n, Value value) const;
private:
void clear();
template <class Value> void push_back (Value const & value, size_type n=1);
- void push_back_space (size_type n=1);
+ value_type push_back_space (size_type n=1);
template <class Value> void push_front (Value const & value, size_type n=1);
- void push_front_space (size_type n=1);
- void resize (size_type n);
+ value_type push_front_space (size_type n=1);
+ void resize (size_type n);
template <class Value> void resize (size_type n, Value value);
///@}
BOOST_CHECK_EQUAL( v.size(), 8u );
BOOST_CHECK_EQUAL( v[7], 0xf0f1u );
- v.push_back_space();
+ v.push_back_space() = 37u;
BOOST_CHECK_EQUAL( v.size(), 9u );
- BOOST_CHECK_EQUAL( v[8], 0u );
+ BOOST_CHECK_EQUAL( v[8], 37u );
v.push_front(0xf3f4u);
BOOST_CHECK_EQUAL( v.size(), 10u );