1 /* boost random/vector_io.hpp header file
3 * Copyright Steven Watanabe 2011
4 * Distributed under the Boost Software License, Version 1.0. (See
5 * accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
8 * See http://www.boost.org for most recent version including documentation.
10 * $Id: vector_io.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
13 #ifndef BOOST_RANDOM_DETAIL_VECTOR_IO_HPP
14 #define BOOST_RANDOM_DETAIL_VECTOR_IO_HPP
24 template<class CharT, class Traits, class T>
25 void print_vector(std::basic_ostream<CharT, Traits>& os,
26 const std::vector<T>& vec)
28 typename std::vector<T>::const_iterator
35 for(; iter != end; ++iter)
37 os << os.widen(' ') << *iter;
43 template<class CharT, class Traits, class T>
44 void read_vector(std::basic_istream<CharT, Traits>& is, std::vector<T>& vec)
50 if(ch != is.widen('[')) {
52 is.setstate(std::ios_base::failbit);
56 while(is >> std::ws >> val) {
64 if(ch != is.widen(']')) {
66 is.setstate(std::ios_base::failbit);
75 #endif // BOOST_RANDOM_DETAIL_VECTOR_IO_HPP