// Copyright Antony Polukhin, 2011-2024. // // 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) #ifndef BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP #define BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP #include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif #include namespace boost { namespace conversion { namespace detail { template < typename CharT > struct buffer_view { const CharT* begin; const CharT* end; }; template < typename CharT > buffer_view make_buffer_view(const CharT* begin, const CharT* end) { return buffer_view{begin, end}; } inline buffer_view make_buffer_view(const signed char* begin, const signed char* end) { return buffer_view{ reinterpret_cast(begin), reinterpret_cast(end) }; } inline buffer_view make_buffer_view(const unsigned char* begin, const unsigned char* end) { return buffer_view{ reinterpret_cast(begin), reinterpret_cast(end) }; } template< typename CharT, typename Elem, typename Traits > std::basic_ostream& operator<<( std::basic_ostream& os, buffer_view r) { while (r.begin != r.end) { os << r.begin[0]; ++r.begin; } return os; } }}} // namespace boost::conversion::detail #endif // BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP