Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as https://reviews.llvm.org/D44263

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342566 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2018-09-19 18:29:57 +00:00
parent 989927cc37
commit f06032bb0a
3 changed files with 92 additions and 3 deletions

View File

@@ -56,6 +56,7 @@ public:
basic_ostream& operator<<(double f);
basic_ostream& operator<<(long double f);
basic_ostream& operator<<(const void* p);
basic_ostream<charT, traits>& operator<<(nullptr_t); // C++17
basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb);
// 27.7.2.7 Unformatted output:
@@ -216,6 +217,7 @@ public:
basic_ostream& operator<<(double __f);
basic_ostream& operator<<(long double __f);
basic_ostream& operator<<(const void* __p);
basic_ostream& operator<<(nullptr_t);
basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
// 27.7.2.7 Unformatted output:
@@ -709,6 +711,14 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(nullptr_t)
{
return *this << "(nullptr)";
}
template<class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
__put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
@@ -742,7 +752,6 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
return __os;
}
template<class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)