Skip to content

Commit

Permalink
to_string() added
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Feb 24, 2017
1 parent 9bcc301 commit d494c83
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/include/in_place_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,18 @@ constexpr bool operator>=(const basic_in_place_string<CharT, MaxSize, Traits>& l


template<typename CharT, std::size_t MaxSize, class Traits>
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
const basic_in_place_string<CharT, MaxSize, Traits>& v)
inline std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
const basic_in_place_string<CharT, MaxSize, Traits>& v)
{
return os << v.data();
}

template<typename CharT, std::size_t MaxSize, class Traits>
inline std::basic_string<CharT, Traits> to_string(const basic_in_place_string<CharT, MaxSize, Traits>& v)
{
return {v.data(), v.size()};
}

template<std::size_t MaxSize> using in_place_string = basic_in_place_string<char, MaxSize>;
template<std::size_t MaxSize> using in_place_wstring = basic_in_place_string<wchar_t, MaxSize>;
template<std::size_t MaxSize> using in_place_u16string = basic_in_place_string<char16_t, MaxSize>;
Expand Down

0 comments on commit d494c83

Please sign in to comment.