File indexing completed on 2023-03-17 11:15:40
0001
0002
0003 #if !defined(dumpSTL_ICC)
0004 #define dumpSTL_ICC
0005
0006 #include <iostream>
0007 #include <iterator>
0008 #include <string>
0009
0010 template <class C>
0011 void dumpSTL(const C &cont, std::ostream &stream = std::cout) {
0012 typedef typename C::value_type T;
0013 std::ostream_iterator<T> output(stream, " ");
0014 std::copy(cont.begin(), cont.end(), output);
0015 }
0016
0017 template <class C>
0018 void dumpSTLendl(const C &cont, std::ostream &stream = std::cout) {
0019 typedef typename C::value_type T;
0020 std::ostream_iterator<T> output(stream, " ");
0021 std::copy(cont.begin(), cont.end(), output);
0022 stream << std::endl;
0023 }
0024
0025 template <class C>
0026 void dumpSTLeachEndl(const C &cont, int offset = 0, std::ostream &stream = std::cout) {
0027 typedef typename C::value_type T;
0028 std::string padding = "\n";
0029 if (offset) {
0030 for (int loop = 0; loop < offset; ++loop) {
0031 padding += " ";
0032 stream << " ";
0033 }
0034 }
0035
0036 std::ostream_iterator<T> output(stream, padding.c_str());
0037 std::copy(cont.begin(), cont.end(), output);
0038 stream << std::endl;
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 }
0056
0057 template <class C>
0058 void dumpNamedSTLendl(const C &cont, const std::string &name, std::ostream &stream = std::cout) {
0059 typedef typename C::value_type T;
0060 stream << name << " ";
0061 std::ostream_iterator<T> output(stream, " ");
0062 std::copy(cont.begin(), cont.end(), output);
0063 stream << std::endl;
0064 }
0065
0066 #endif