32 #ifndef MCKL_INTERNAL_IOSTREAM_HPP 33 #define MCKL_INTERNAL_IOSTREAM_HPP 45 template <
typename CharT,
typename Traits,
typename T, std::
size_t N>
46 inline std::basic_ostream<CharT, Traits> &
ostream(
47 std::basic_ostream<CharT, Traits> &os,
const std::array<T, N> &ary)
58 for (
const auto &v : ary) {
65 template <
typename CharT,
typename Traits,
typename T, std::
size_t N>
66 inline std::basic_istream<CharT, Traits> &
istream(
67 std::basic_istream<CharT, Traits> &is, std::array<T, N> &ary)
82 for (std::size_t i = 0; i != n; ++i) {
83 is >> std::ws >> tmp[i];
92 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
93 inline std::basic_ostream<CharT, Traits> &
ostream(
94 std::basic_ostream<CharT, Traits> &os,
const std::vector<T, Alloc> &vec)
105 for (
const auto &v : vec) {
112 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
113 inline std::basic_istream<CharT, Traits> &
istream(
114 std::basic_istream<CharT, Traits> &is, std::vector<T, Alloc> &vec)
126 std::vector<T, Alloc> tmp(n);
127 for (std::size_t i = 0; i != n; ++i) {
128 is >> std::ws >> tmp[i];
131 vec = std::move(tmp);
137 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
138 inline std::basic_ostream<CharT, Traits> &
ostream(
139 std::basic_ostream<CharT, Traits> &os,
const std::list<T, Alloc> &lst)
150 for (
const auto &v : lst) {
157 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
158 inline std::basic_istream<CharT, Traits> &
istream(
159 std::basic_istream<CharT, Traits> &is, std::list<T, Alloc> &lst)
171 std::list<T, Alloc> tmp;
173 for (std::size_t i = 0; i != n; ++i) {
174 is >> std::ws >> val;
178 lst = std::move(tmp);
186 template <
typename CharT,
typename Traits,
typename T, std::
size_t N>
188 std::basic_ostream<CharT, Traits> &os,
const std::array<T, N> &ary)
193 template <
typename CharT,
typename Traits,
typename T, std::
size_t N>
195 std::basic_istream<CharT, Traits> &is, std::array<T, N> &ary)
200 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
202 std::basic_ostream<CharT, Traits> &os,
const std::vector<T, Alloc> &vec)
207 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
209 std::basic_istream<CharT, Traits> &is, std::vector<T, Alloc> &vec)
214 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
216 std::basic_ostream<CharT, Traits> &os,
const std::list<T, Alloc> &lst)
221 template <
typename CharT,
typename Traits,
typename T,
typename Alloc>
223 std::basic_istream<CharT, Traits> &is, std::list<T, Alloc> &lst)
230 #endif // MCKL_INTERNAL_IOSTREAM_HPP
std::basic_ostream< CharT, Traits > & ostream(std::basic_ostream< CharT, Traits > &os, const std::array< T, N > &ary)
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const Matrix< T, Layout, Alloc > &mat)
Output operator.
std::basic_istream< CharT, Traits > & istream(std::basic_istream< CharT, Traits > &is, std::array< T, N > &ary)
std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &is, Matrix< T, Layout, Alloc > &mat)
Input operator.