blob: 3786623de3950b6055df98088e8acf19afb8ca51 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// Boost.Range library
2//
3// Copyright Neil Groves 2009.
4// Use, modification and distribution is subject to the Boost Software
5// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8// For more information, see http://www.boost.org/libs/range/
9//
Jeff Thompson3d613fd2013-10-15 15:39:04 -070010#ifndef NDNBOOST_RANGE_ITERATOR_RANGE_IO_HPP_INCLUDED
11#define NDNBOOST_RANGE_ITERATOR_RANGE_IO_HPP_INCLUDED
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070012
13#include <ndnboost/config.hpp>
14#include <ndnboost/detail/workaround.hpp>
15
Jeff Thompson3d613fd2013-10-15 15:39:04 -070016#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, NDNBOOST_TESTED_AT(1500))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070017 #pragma warning( push )
18 #pragma warning( disable : 4996 )
19#endif
20
Jeff Thompson9939dcd2013-10-15 15:12:24 -070021// From ndnboost/dynamic_bitset.hpp; thanks to Matthias Troyer for Cray X1 patch.
Jeff Thompson3d613fd2013-10-15 15:39:04 -070022#ifndef NDNBOOST_OLD_IOSTREAMS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070023# if defined(__STL_CONFIG_H) && \
24 !defined (__STL_USE_NEW_IOSTREAMS) && !defined(__crayx1) \
25 /**/
Jeff Thompson3d613fd2013-10-15 15:39:04 -070026# define NDNBOOST_OLD_IOSTREAMS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070027# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070028#endif // #ifndef NDNBOOST_OLD_IOSTREAMS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070029
30#ifndef _STLP_NO_IOSTREAMS
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031# ifndef NDNBOOST_OLD_IOSTREAMS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070032# include <ostream>
33# else
34# include <ostream.h>
35# endif
36#endif // _STLP_NO_IOSTREAMS
37
38#include <ndnboost/range/iterator_range_core.hpp>
39#include <iterator>
40#include <algorithm>
41#include <cstddef>
42
43namespace ndnboost
44{
45
46#ifndef _STLP_NO_IOSTREAMS
Jeff Thompson3d613fd2013-10-15 15:39:04 -070047# ifndef NDNBOOST_OLD_IOSTREAMS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070048
49 //! iterator_range output operator
50 /*!
51 Output the range to an ostream. Elements are outputted
52 in a sequence without separators.
53 */
54 template< typename IteratorT, typename Elem, typename Traits >
55 inline std::basic_ostream<Elem,Traits>& operator<<(
56 std::basic_ostream<Elem, Traits>& Os,
57 const iterator_range<IteratorT>& r )
58 {
59 std::copy( r.begin(), r.end(),
Jeff Thompson3d613fd2013-10-15 15:39:04 -070060 std::ostream_iterator< NDNBOOST_DEDUCED_TYPENAME
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070061 iterator_value<IteratorT>::type,
62 Elem, Traits>(Os) );
63 return Os;
64 }
65
66# else
67
68 //! iterator_range output operator
69 /*!
70 Output the range to an ostream. Elements are outputted
71 in a sequence without separators.
72 */
73 template< typename IteratorT >
74 inline std::ostream& operator<<(
75 std::ostream& Os,
76 const iterator_range<IteratorT>& r )
77 {
78 std::copy( r.begin(), r.end(), std::ostream_iterator<char>(Os));
79 return Os;
80 }
81
82# endif
83#endif // _STLP_NO_IOSTREAMS
84
85} // namespace ndnboost
86
Jeff Thompson3d613fd2013-10-15 15:39:04 -070087#undef NDNBOOST_OLD_IOSTREAMS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070088
Jeff Thompson3d613fd2013-10-15 15:39:04 -070089#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, NDNBOOST_TESTED_AT(1500))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070090 #pragma warning(pop)
91#endif
92
93#endif // include guard