Ticket #7299: output_iterator.hpp.patch

File output_iterator.hpp.patch, 2.1 KB (added by Dave Bailey <David.Bailey@…>, 10 years ago)
  • output_iterator.hpp

     
    2121#include <boost/spirit/home/karma/generator.hpp>
    2222#include <boost/spirit/home/support/iterators/ostream_iterator.hpp>
    2323#include <boost/spirit/home/support/unused.hpp>
     24#ifdef BOOST_SPIRIT_UNICODE
     25#include <boost/spirit/home/support/char_encoding/unicode.hpp>
     26#endif
    2427
    2528namespace boost { namespace spirit { namespace karma { namespace detail
    2629{
     
    172175    ///////////////////////////////////////////////////////////////////////////
    173176    class buffer_sink : boost::noncopyable
    174177    {
     178
     179#ifdef BOOST_SPIRIT_UNICODE
     180        typedef boost::spirit::char_encoding::unicode::char_type buffer_sink_char_type;
     181#else
     182        typedef wchar_t buffer_sink_char_type;
     183#endif
     184
    175185    public:
    176186        buffer_sink()
    177187          : width(0) {}
     
    197207        template <typename T>
    198208        void output(T const& value)
    199209        {
    200             BOOST_STATIC_ASSERT(sizeof(T) <= sizeof(wchar_t));
     210            BOOST_STATIC_ASSERT(sizeof(T) <= sizeof(buffer_sink_char_type));
    201211            buffer.push_back(value);
    202212        }
    203213
     
    208218#pragma warning(push)
    209219#pragma warning(disable: 4267)
    210220#endif
    211             typename std::basic_string<wchar_t>::const_iterator end =
     221            typename std::basic_string<buffer_sink_char_type>::const_iterator end =
    212222                buffer.begin() + (std::min)(buffer.size(), maxwidth);
    213223
    214224#if defined(BOOST_MSVC)
     
    224234#pragma warning(push)
    225235#pragma warning(disable: 4267)
    226236#endif
    227             typename std::basic_string<wchar_t>::const_iterator begin =
     237            typename std::basic_string<buffer_sink_char_type>::const_iterator begin =
    228238                buffer.begin() + (std::min)(buffer.size(), start_at);
    229239
    230240#if defined(BOOST_MSVC)
     
    241251
    242252    private:
    243253        std::size_t width;
    244         std::basic_string<wchar_t> buffer;
     254        std::basic_string<buffer_sink_char_type> buffer;
    245255    };
    246256
    247257    ///////////////////////////////////////////////////////////////////////////