⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ostream_iterator.hpp

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 HPP
字号:
//  Copyright (c) 2001-2008 Hartmut Kaiser// //  Distributed under the Boost Software License, Version 1.0. (See accompanying //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)#if !defined(BOOST_SPIRIT_KARMA_OSTREAM_ITERATOR_MAY_26_2007_1016PM)#define BOOST_SPIRIT_KARMA_OSTREAM_ITERATOR_MAY_26_2007_1016PM#include <iterator>///////////////////////////////////////////////////////////////////////////////namespace boost { namespace spirit { namespace karma { namespace detail{    ///////////////////////////////////////////////////////////////////////////    //  We need our own implementation of an ostream_iterator just to be able    //  to access the wrapped ostream, which is necessary for the     //  stream_director, where we must generate the output using the original    //  ostream to retain possibly registered facets.    ///////////////////////////////////////////////////////////////////////////    template <        typename T, typename Elem = char,         typename Traits = std::char_traits<Elem>     >    class ostream_iterator       : public std::iterator<std::output_iterator_tag, void, void, void, void>    {    public:        typedef Elem char_type;        typedef Traits traits_type;        typedef std::basic_ostream<Elem, Traits> ostream_type;        typedef ostream_iterator<T, Elem, Traits> self_type;                ostream_iterator(ostream_type& os_, Elem const* delim_ = 0)          : os(&os_), delim(delim_) {}        self_type& operator= (T const& val)        {            *os << val;            if (0 != delim)                *os << delim;            return *this;        }        self_type& operator*() { return *this; }        self_type& operator++() { return *this; }        self_type operator++(int) { return *this; }        ostream_type& get_ostream() { return *os; }            protected:        ostream_type *os;        Elem const* delim;    };}}}}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -