91 #include "../r_code/resized_vector.h"
101 OutStream(std::ostringstream *s) : stream_(s) {}
102 std::ostringstream *stream_;
103 template<
typename T>
OutStream &push(
const T &t, uint16 code_index) {
104 positions_.push_back(stream_->tellp());
105 code_indexes_to_stream_indexes_[code_index] = positions_.size() - 1;
110 positions_.push_back(p);
113 template<
typename T>
OutStream &operator <<(
const T &t) {
117 template<
typename T>
OutStream &insert(uint32 index,
const T &t) {
118 uint16 stream_index = code_indexes_to_stream_indexes_[index];
119 stream_->seekp(positions_[stream_index]);
120 std::string s = stream_->str().substr(positions_[stream_index]);
122 std::streamoff offset = stream_->tellp() - positions_[stream_index];
124 for (uint16 i = stream_index + 1; i < positions_.size(); ++i)
125 positions_[i] += offset;
131 public std::ostream {
134 template<
typename T>
NoStream& operator <<(T &t) {
140 public std::ostream {
143 template<
typename T> std::ostream& operator <<(T &t) {
145 return std::cout << t;