Index: output_iterator.hpp =================================================================== --- output_iterator.hpp (revision 80305) +++ output_iterator.hpp (working copy) @@ -21,6 +21,9 @@ #include #include #include +#ifdef BOOST_SPIRIT_UNICODE +#include +#endif namespace boost { namespace spirit { namespace karma { namespace detail { @@ -172,6 +175,13 @@ /////////////////////////////////////////////////////////////////////////// class buffer_sink : boost::noncopyable { + +#ifdef BOOST_SPIRIT_UNICODE + typedef boost::spirit::char_encoding::unicode::char_type buffer_sink_char_type; +#else + typedef wchar_t buffer_sink_char_type; +#endif + public: buffer_sink() : width(0) {} @@ -197,7 +207,7 @@ template void output(T const& value) { - BOOST_STATIC_ASSERT(sizeof(T) <= sizeof(wchar_t)); + BOOST_STATIC_ASSERT(sizeof(T) <= sizeof(buffer_sink_char_type)); buffer.push_back(value); } @@ -208,7 +218,7 @@ #pragma warning(push) #pragma warning(disable: 4267) #endif - typename std::basic_string::const_iterator end = + typename std::basic_string::const_iterator end = buffer.begin() + (std::min)(buffer.size(), maxwidth); #if defined(BOOST_MSVC) @@ -224,7 +234,7 @@ #pragma warning(push) #pragma warning(disable: 4267) #endif - typename std::basic_string::const_iterator begin = + typename std::basic_string::const_iterator begin = buffer.begin() + (std::min)(buffer.size(), start_at); #if defined(BOOST_MSVC) @@ -241,7 +251,7 @@ private: std::size_t width; - std::basic_string buffer; + std::basic_string buffer; }; ///////////////////////////////////////////////////////////////////////////