fix string_ref io

This commit is contained in:
bolero-MURAKAMI 2013-04-08 17:45:03 +09:00
parent f0dfb208e0
commit ef5aa728b0

View file

@ -1,6 +1,8 @@
#ifndef SPROUT_UTILITY_STRING_IO_HPP #ifndef SPROUT_UTILITY_STRING_IO_HPP
#define SPROUT_UTILITY_STRING_IO_HPP #define SPROUT_UTILITY_STRING_IO_HPP
#include <iterator>
#include <algorithm>
#include <ios> #include <ios>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/string_ref/string_ref.hpp> #include <sprout/utility/string_ref/string_ref.hpp>
@ -12,7 +14,8 @@ namespace sprout {
template<typename T, typename Traits, typename StreamTraits> template<typename T, typename Traits, typename StreamTraits>
inline std::basic_ostream<T, StreamTraits>& inline std::basic_ostream<T, StreamTraits>&
operator<<(std::basic_ostream<T, StreamTraits>& lhs, sprout::basic_string_ref<T, Traits> const& rhs) { operator<<(std::basic_ostream<T, StreamTraits>& lhs, sprout::basic_string_ref<T, Traits> const& rhs) {
return lhs << rhs.c_str(); std::copy(rhs.begin(), rhs.end(), std::ostreambuf_iterator<T, StreamTraits>(lhs));
return lhs;
} }
} // namespace sprout } // namespace sprout