43 #include "rsc/rscexports.h"
59 pair_style(
const string& open_brace =
"(",
const string& separator =
", ",
60 const string& close_brace =
")");
81 const string& first_separator =
"",
82 const string& last_separator =
"");
92 template<
typename Ch,
typename Tr,
typename T>
93 basic_ostream<Ch, Tr>&
94 operator<<(basic_ostream<Ch, Tr>& stream,
98 delete reinterpret_cast<detail::pair_style*> (stream.pword(
109 RSC_EXPORT
extern const detail::set_pair_style<detail::pair_style> pair_default;
110 RSC_EXPORT
extern const detail::set_pair_style<detail::pair_style>
113 template<
typename Ch,
typename Tr,
typename T>
114 basic_ostream<Ch, Tr>&
115 operator<<(basic_ostream<Ch, Tr>& stream,
116 const detail::set_container_style<T>& style) {
119 delete reinterpret_cast<detail::container_style*> (stream.pword(
130 RSC_EXPORT
extern const detail::set_container_style<detail::container_style> container_singleline;
131 RSC_EXPORT
extern const detail::set_container_style<detail::container_style> container_multiline;
133 template<
typename Ch,
typename Tr,
typename R,
typename S>
134 basic_ostream<Ch, Tr>&
135 operator<<(basic_ostream<Ch, Tr>& stream,
const pair<R, S>& pair) {
139 stream << pair_default;
141 detail::pair_style& style =
142 *
reinterpret_cast<detail::pair_style*
> (stream.pword(
145 stream << style.open_brace << pair.first << style.separator << pair.second
146 << style.close_brace;
150 template<
typename Ch,
typename Tr,
typename T>
151 basic_ostream<Ch, Tr>&
152 operator<<(basic_ostream<Ch, Tr>& stream,
const vector<T>& container) {
153 typedef vector<T> container_type;
154 typedef typename container_type::value_type value_type;
157 stream << container_singleline;
160 detail::container_style& style =
161 *
reinterpret_cast<detail::container_style*
>(stream.pword(
165 if (container.size() >= 1) {
166 stream << style.first_separator;
167 copy(container.begin(), container.end() - 1,
168 ostream_iterator<value_type> (stream, style.separator.c_str()));
169 stream << container.back();
170 stream << style.last_separator;
176 template<
typename Ch,
typename Tr,
typename T>
177 basic_ostream<Ch, Tr>&
178 operator<<(basic_ostream<Ch, Tr>& stream,
const deque<T>& container) {
179 typedef vector<T> container_type;
180 typedef typename container_type::value_type value_type;
183 stream << container_singleline;
186 detail::container_style& style =
187 *
reinterpret_cast<detail::container_style*
>(stream.pword(
191 if (container.size() >= 1) {
192 stream << style.first_separator;
193 copy(container.begin(), container.end() - 1,
194 ostream_iterator<value_type> (stream, style.separator.c_str()));
195 stream << container.back();
196 stream << style.last_separator;
202 template<
typename Ch,
typename Tr,
typename T>
203 basic_ostream<Ch, Tr>&
204 operator<<(basic_ostream<Ch, Tr>& stream,
const list<T>& container) {
205 typedef list<T> container_type;
206 typedef typename container_type::value_type value_type;
209 stream << container_singleline;
212 detail::container_style& style =
213 *
reinterpret_cast<detail::container_style*
>(stream.pword(
217 if (container.size() >= 1) {
218 stream << style.first_separator;
219 copy(container.begin(), --container.end(),
220 ostream_iterator<value_type> (stream, style.separator.c_str()));
221 stream << container.back();
222 stream << style.last_separator;
228 template<
typename Ch,
typename Tr,
typename T>
229 basic_ostream<Ch, Tr>&
230 operator<<(basic_ostream<Ch, Tr>& stream,
const set<T>& container) {
231 typedef set<T> container_type;
232 typedef typename container_type::value_type value_type;
235 stream << container_singleline;
238 detail::container_style& style =
239 *
reinterpret_cast<detail::container_style*
>(stream.pword(
243 if (container.size() >= 1) {
244 stream << style.first_separator;
245 copy(++container.begin(), container.end(),
246 ostream_iterator<value_type> (stream, style.separator.c_str()));
247 stream << *container.begin();
248 stream << style.last_separator;
254 template<
typename Ch,
typename Tr,
typename R,
typename S>
255 basic_ostream<Ch, Tr>&
256 operator<<(basic_ostream<Ch, Tr>& stream,
const map<R, S>& container) {
257 typedef map<R, S> container_type;
260 stream << container_singleline;
263 detail::container_style& style =
264 *
reinterpret_cast<detail::container_style*
>(stream.pword(
268 stream << style.first_separator;
269 for (
typename container_type::const_iterator it = container.begin(); it
270 != container.end();) {
272 if (++it != container.end())
273 stream << style.separator;
275 stream << style.last_separator;
280 template<
typename Ch,
typename Tr,
typename R,
typename S>
281 basic_ostream<Ch, Tr>&
282 operator<<(basic_ostream<Ch, Tr>& stream,
const multimap<R, S>& container) {
283 typedef multimap<R, S> container_type;
286 stream << container_singleline;
289 detail::container_style& style =
290 *
reinterpret_cast<detail::container_style*
>(stream.pword(
294 stream << style.first_separator;
295 for (
typename container_type::const_iterator it = container.begin(); it
296 != container.end();) {
298 if (++it != container.end())
299 stream << style.separator;
301 stream << style.last_separator;
306 template<
typename Ch,
typename Tr,
typename T>
307 basic_ostream<Ch, Tr>&
308 operator<<(basic_ostream<Ch, Tr>& stream,
const valarray<T>& container) {
309 typedef valarray<T> container_type;
310 typedef typename container_type::value_type value_type;
313 stream << container_singleline;
316 detail::container_style& style =
317 *
reinterpret_cast<detail::container_style*
>(stream.pword(
321 stream << style.first_separator;
322 for (
unsigned int i = 0; i != container.size(); ++i) {
323 stream << container[i];
324 if (i != container.size() - 1)
325 stream << style.separator;
327 stream << style.last_separator;
void container_style_delete(ios_base::event event_, ios_base &stream, int)
void pair_style_delete(ios_base::event event_, ios_base &stream, int)
static const int stream_storage
static const int stream_storage