aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2020-11-24 12:53:53 -0500
committerLouis Dionne <ldionne.2@gmail.com>2020-11-27 10:00:21 -0500
commit527a7fdfbd7461e2aaa9eb279543c5d9dc8efa5a (patch)
treeddf570e1ec474116ba040c625ef56040ae02884e /libcxx
parent4c419c454ad255437331987dbd3ada6070432999 (diff)
downloadllvm-project-527a7fdfbd7461e2aaa9eb279543c5d9dc8efa5a.tar.gz
[libc++] Replace several uses of 0 by nullptr
Differential Revision: https://reviews.llvm.org/D43159
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/__locale2
-rw-r--r--libcxx/include/__sso_allocator2
-rw-r--r--libcxx/include/__string16
-rw-r--r--libcxx/include/__threading_support6
-rw-r--r--libcxx/include/algorithm34
-rw-r--r--libcxx/include/bitset8
-rw-r--r--libcxx/include/chrono6
-rw-r--r--libcxx/include/fstream120
-rw-r--r--libcxx/include/functional38
-rw-r--r--libcxx/include/ios4
-rw-r--r--libcxx/include/istream6
-rw-r--r--libcxx/include/iterator24
-rw-r--r--libcxx/include/locale34
-rw-r--r--libcxx/include/memory42
-rw-r--r--libcxx/include/regex12
-rw-r--r--libcxx/include/sstream10
-rw-r--r--libcxx/include/streambuf12
-rw-r--r--libcxx/include/string66
-rw-r--r--libcxx/include/strstream12
-rw-r--r--libcxx/include/system_error4
-rw-r--r--libcxx/include/valarray38
-rw-r--r--libcxx/src/new.cpp10
22 files changed, 253 insertions, 253 deletions
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index fd09206b6c5d..23ad424e3c0f 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -628,7 +628,7 @@ class _LIBCPP_TYPE_VIS ctype<char>
public:
typedef char char_type;
- explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
+ explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
_LIBCPP_INLINE_VISIBILITY
bool is(mask __m, char_type __c) const
diff --git a/libcxx/include/__sso_allocator b/libcxx/include/__sso_allocator
index 117b728f1499..c50ae24c9212 100644
--- a/libcxx/include/__sso_allocator
+++ b/libcxx/include/__sso_allocator
@@ -48,7 +48,7 @@ public:
private:
__sso_allocator& operator=(const __sso_allocator&);
public:
- _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
+ _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = nullptr)
{
if (!__allocated_ && __n <= _Np)
{
diff --git a/libcxx/include/__string b/libcxx/include/__string
index f9d02064401e..08be8f1a7641 100644
--- a/libcxx/include/__string
+++ b/libcxx/include/__string
@@ -268,7 +268,7 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a
return __s;
++__s;
}
- return 0;
+ return nullptr;
}
template <class _CharT>
@@ -683,7 +683,7 @@ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __
return __s;
++__s;
}
- return 0;
+ return nullptr;
}
#endif // #_LIBCPP_NO_HAS_CHAR8_T
@@ -765,7 +765,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
return __s;
++__s;
}
- return 0;
+ return nullptr;
}
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
@@ -885,7 +885,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
return __s;
++__s;
}
- return 0;
+ return nullptr;
}
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
@@ -943,7 +943,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
if (__pos >= __sz)
return __npos;
const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
- if (__r == 0)
+ if (__r == nullptr)
return __npos;
return static_cast<_SizeT>(__r - __p);
}
@@ -972,7 +972,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
// Find __f2 the first byte matching in __first1.
__first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2);
- if (__first1 == 0)
+ if (__first1 == nullptr)
return __last1;
// It is faster to compare from the first byte of __first1 even if we
@@ -1095,7 +1095,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz,
{
const _CharT* __pe = __p + __sz;
for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
- if (_Traits::find(__s, __n, *__ps) == 0)
+ if (_Traits::find(__s, __n, *__ps) == nullptr)
return static_cast<_SizeT>(__ps - __p);
}
return __npos;
@@ -1129,7 +1129,7 @@ __str_find_last_not_of(const _CharT *__p, _SizeT __sz,
else
__pos = __sz;
for (const _CharT* __ps = __p + __pos; __ps != __p;)
- if (_Traits::find(__s, __n, *--__ps) == 0)
+ if (_Traits::find(__s, __n, *--__ps) == nullptr)
return static_cast<_SizeT>(__ps - __p);
return __npos;
}
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index 85bb96bdc6ba..2d0ccf5cb244 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -497,13 +497,13 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
// Thread
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
- return *__t == 0;
+ return *__t == __libcpp_thread_t();
}
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
void *__arg)
{
- return pthread_create(__t, 0, __func, __arg);
+ return pthread_create(__t, nullptr, __func, __arg);
}
__libcpp_thread_id __libcpp_thread_get_current_id()
@@ -518,7 +518,7 @@ __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
int __libcpp_thread_join(__libcpp_thread_t *__t)
{
- return pthread_join(*__t, 0);
+ return pthread_join(*__t, nullptr);
}
int __libcpp_thread_detach(__libcpp_thread_t *__t)
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 4e1afe651acb..f047ae1b1dee 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -3405,7 +3405,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
// Update __first to always point to the end of the trues
value_type* __t = __p.first;
::new(__t) value_type(_VSTD::move(*__first));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__t;
_ForwardIterator __i = __first;
while (++__i != __last)
@@ -3418,7 +3418,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
else
{
::new(__t) value_type(_VSTD::move(*__i));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__t;
}
}
@@ -3535,7 +3535,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
// Update __first to always point to the end of the trues
value_type* __t = __p.first;
::new(__t) value_type(_VSTD::move(*__first));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__t;
_BidirectionalIterator __i = __first;
while (++__i != __last)
@@ -3548,7 +3548,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
else
{
::new(__t) value_type(_VSTD::move(*__i));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__t;
}
}
@@ -3923,7 +3923,7 @@ __insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator
unique_ptr<value_type, __destruct_n&> __h(__first2, __d);
value_type* __last2 = __first2;
::new(__last2) value_type(_VSTD::move(*__first1));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
for (++__last2; ++__first1 != __last1; ++__last2)
{
value_type* __j2 = __last2;
@@ -3931,7 +3931,7 @@ __insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator
if (__comp(*__first1, *--__i2))
{
::new(__j2) value_type(_VSTD::move(*__i2));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2)
*__j2 = _VSTD::move(*__i2);
*__j2 = _VSTD::move(*__first1);
@@ -3939,7 +3939,7 @@ __insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator
else
{
::new(__j2) value_type(_VSTD::move(*__first1));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
}
}
__h.release();
@@ -4481,14 +4481,14 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
if (__len1 <= __len2)
{
value_type* __p = __buff;
- for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
+ for (_BidirectionalIterator __i = __first; __i != __middle; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
::new(__p) value_type(_VSTD::move(*__i));
__half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
}
else
{
value_type* __p = __buff;
- for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
+ for (_BidirectionalIterator __i = __middle; __i != __last; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
::new(__p) value_type(_VSTD::move(*__i));
typedef reverse_iterator<_BidirectionalIterator> _RBi;
typedef reverse_iterator<value_type*> _Rv;
@@ -4628,14 +4628,14 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
{
if (__first1 == __last1)
{
- for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0))
+ for (; __first2 != __last2; ++__first2, ++__result, (void)__d.template __incr<value_type>())
::new (__result) value_type(_VSTD::move(*__first2));
__h.release();
return;
}
if (__first2 == __last2)
{
- for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0))
+ for (; __first1 != __last1; ++__first1, ++__result, (void)__d.template __incr<value_type>())
::new (__result) value_type(_VSTD::move(*__first1));
__h.release();
return;
@@ -4643,13 +4643,13 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
if (__comp(*__first2, *__first1))
{
::new (__result) value_type(_VSTD::move(*__first2));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__first2;
}
else
{
::new (__result) value_type(_VSTD::move(*__first1));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__first1;
}
}
@@ -4710,14 +4710,14 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1
if (__comp(*--__last1, *__first1))
{
::new(__first2) value_type(_VSTD::move(*__last1));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__first2;
::new(__first2) value_type(_VSTD::move(*__first1));
}
else
{
::new(__first2) value_type(_VSTD::move(*__first1));
- __d.__incr((value_type*)0);
+ __d.template __incr<value_type>();
++__first2;
::new(__first2) value_type(_VSTD::move(*__last1));
}
@@ -4772,9 +4772,9 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
__destruct_n __d(0);
unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
__stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff);
- __d.__set(__l2, (value_type*)0);
+ __d.__set(__l2, (value_type*)nullptr);
__stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
- __d.__set(__len, (value_type*)0);
+ __d.__set(__len, (value_type*)nullptr);
__merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
// __merge<_Compare>(move_iterator<value_type*>(__buff),
// move_iterator<value_type*>(__buff + __l2),
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 4755fbeb2152..0096989eaf43 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -625,13 +625,13 @@ protected:
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
- {return reference(0, 1);}
+ {return reference(nullptr, 1);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
- {return const_reference(0, 1);}
+ {return const_reference(nullptr, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
- {return iterator(0, 0);}
+ {return iterator(nullptr, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
- {return const_iterator(0, 0);}
+ {return const_iterator(nullptr, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index 7b53a0d48965..53e4546010cd 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -1077,7 +1077,7 @@ public:
is_convertible<_Rep2, rep>::value &&
(treat_as_floating_point<rep>::value ||
!treat_as_floating_point<_Rep2>::value)
- >::type* = 0)
+ >::type* = nullptr)
: __rep_(__r) {}
// conversions
@@ -1090,7 +1090,7 @@ public:
treat_as_floating_point<rep>::value ||
(__no_overflow<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value))
- >::type* = 0)
+ >::type* = nullptr)
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
// observer
@@ -1376,7 +1376,7 @@ public:
typename enable_if
<
is_convertible<_Duration2, duration>::value
- >::type* = 0)
+ >::type* = nullptr)
: __d_(t.time_since_epoch()) {}
// observer
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index 1e2d6072e8fe..af8476c6d451 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -287,13 +287,13 @@ private:
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::basic_filebuf()
- : __extbuf_(0),
- __extbufnext_(0),
- __extbufend_(0),
+ : __extbuf_(nullptr),
+ __extbufnext_(nullptr),
+ __extbufend_(nullptr),
__ebs_(0),
- __intbuf_(0),
+ __intbuf_(nullptr),
__ibs_(0),
- __file_(0),
+ __file_(nullptr),
__cv_(nullptr),
__st_(),
__st_last_(),
@@ -308,7 +308,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
__always_noconv_ = __cv_->always_noconv();
}
- setbuf(0, 4096);
+ setbuf(nullptr, 4096);
}
#ifndef _LIBCPP_CXX03_LANG
@@ -360,13 +360,13 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
(char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
(char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
}
- __rhs.__extbuf_ = 0;
- __rhs.__extbufnext_ = 0;
- __rhs.__extbufend_ = 0;
+ __rhs.__extbuf_ = nullptr;
+ __rhs.__extbufnext_ = nullptr;
+ __rhs.__extbufend_ = nullptr;
__rhs.__ebs_ = 0;
__rhs.__intbuf_ = 0;
__rhs.__ibs_ = 0;
- __rhs.__file_ = 0;
+ __rhs.__file_ = nullptr;
__rhs.__st_ = state_type();
__rhs.__st_last_ = state_type();
__rhs.__om_ = 0;
@@ -500,7 +500,7 @@ inline
bool
basic_filebuf<_CharT, _Traits>::is_open() const
{
- return __file_ != 0;
+ return __file_ != nullptr;
}
template <class _CharT, class _Traits>
@@ -548,8 +548,8 @@ template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>*
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
{
- basic_filebuf<_CharT, _Traits>* __rt = 0;
- if (__file_ == 0)
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_ == nullptr)
{
if (const char* __mdstr = __make_mdstring(__mode)) {
__rt = this;
@@ -559,12 +559,12 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
if (__mode & ios_base::ate) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
- __file_ = 0;
- __rt = 0;
+ __file_ = nullptr;
+ __rt = nullptr;
}
}
} else
- __rt = 0;
+ __rt = nullptr;
}
}
return __rt;
@@ -574,8 +574,8 @@ template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_filebuf<_CharT, _Traits>*
basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
- basic_filebuf<_CharT, _Traits>* __rt = 0;
- if (__file_ == 0) {
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_ == nullptr) {
if (const char* __mdstr = __make_mdstring(__mode)) {
__rt = this;
__file_ = fdopen(__fd, __mdstr);
@@ -584,12 +584,12 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (__mode & ios_base::ate) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
- __file_ = 0;
- __rt = 0;
+ __file_ = nullptr;
+ __rt = nullptr;
}
}
} else
- __rt = 0;
+ __rt = nullptr;
}
}
return __rt;
@@ -602,8 +602,8 @@ template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>*
basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
{
- basic_filebuf<_CharT, _Traits>* __rt = 0;
- if (__file_ == 0)
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_ == nullptr)
{
__rt = this;
const wchar_t* __mdstr;
@@ -652,7 +652,7 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo
__mdstr = L"a+b";
break;
default:
- __rt = 0;
+ __rt = nullptr;
break;
}
if (__rt)
@@ -666,13 +666,13 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo
if (fseek(__file_, 0, SEEK_END))
{
fclose(__file_);
- __file_ = 0;
- __rt = 0;
+ __file_ = nullptr;
+ __rt = nullptr;
}
}
}
else
- __rt = 0;
+ __rt = nullptr;
}
}
return __rt;
@@ -692,16 +692,16 @@ template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>*
basic_filebuf<_CharT, _Traits>::close()
{
- basic_filebuf<_CharT, _Traits>* __rt = 0;
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
if (__file_)
{
__rt = this;
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
if (sync())
- __rt = 0;
+ __rt = nullptr;
if (fclose(__h.release()))
- __rt = 0;
- __file_ = 0;
+ __rt = nullptr;
+ __file_ = nullptr;
setbuf(0, 0);
}
return __rt;
@@ -711,11 +711,11 @@ template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::underflow()
{
- if (__file_ == 0)
+ if (__file_ == nullptr)
return traits_type::eof();
bool __initial = __read_mode();
char_type __1buf;
- if (this->gptr() == 0)
+ if (this->gptr() == nullptr)
this->setg(&__1buf, &__1buf+1, &__1buf+1);
const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
int_type __c = traits_type::eof();
@@ -773,7 +773,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
else
__c = traits_type::to_int_type(*this->gptr());
if (this->eback() == &__1buf)
- this->setg(0, 0, 0);
+ this->setg(nullptr, nullptr, nullptr);
return __c;
}
@@ -803,7 +803,7 @@ template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
{
- if (__file_ == 0)
+ if (__file_ == nullptr)
return traits_type::eof();
__write_mode();
char_type __1buf;
@@ -811,7 +811,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
char_type* __epb_save = this->epptr();
if (!traits_type::eq_int_type(__c, traits_type::eof()))
{
- if (this->pptr() == 0)
+ if (this->pptr() == nullptr)
this->setp(&__1buf, &__1buf+1);
*this->pptr() = traits_type::to_char_type(__c);
this->pbump(1);
@@ -868,8 +868,8 @@ template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>*
basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
{
- this->setg(0, 0, 0);
- this->setp(0, 0);
+ this->setg(nullptr, nullptr, nullptr);
+ this->setp(nullptr, nullptr);
if (__owns_eb_)
delete [] __extbuf_;
if (__owns_ib_)
@@ -911,7 +911,7 @@ basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
else
{
__ibs_ = 0;
- __intbuf_ = 0;
+ __intbuf_ = nullptr;
__owns_ib_ = false;
}
return this;
@@ -926,7 +926,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
__throw_bad_cast();
int __width = __cv_->encoding();
- if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
+ if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
// __width > 0 || __off == 0
int __whence;
@@ -961,7 +961,7 @@ template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
{
- if (__file_ == 0 || sync())
+ if (__file_ == nullptr || sync())
return pos_type(off_type(-1));
#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
if (fseek(__file_, __sp, SEEK_SET))
@@ -978,7 +978,7 @@ template <class _CharT, class _Traits>
int
basic_filebuf<_CharT, _Traits>::sync()
{
- if (__file_ == 0)
+ if (__file_ == nullptr)
return 0;
if (!__cv_)
__throw_bad_cast();
@@ -1037,7 +1037,7 @@ basic_filebuf<_CharT, _Traits>::sync()
if (__update_st)
__st_ = __state;
__extbufnext_ = __extbufend_ = __extbuf_;
- this->setg(0, 0, 0);
+ this->setg(nullptr, nullptr, nullptr);
__cm_ = 0;
}
return 0;
@@ -1053,8 +1053,8 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
__always_noconv_ = __cv_->always_noconv();
if (__old_anc != __always_noconv_)
{
- this->setg(0, 0, 0);
- this->setp(0, 0);
+ this->setg(nullptr, nullptr, nullptr);
+ this->setp(nullptr, nullptr);
// invariant, char_type is char, else we couldn't get here
if (__always_noconv_) // need to dump __intbuf_
{
@@ -1064,7 +1064,7 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
__ebs_ = __ibs_;
__extbuf_ = (char*)__intbuf_;
__ibs_ = 0;
- __intbuf_ = 0;
+ __intbuf_ = nullptr;
__owns_ib_ = false;
}
else // need to obtain an __intbuf_.
@@ -1093,7 +1093,7 @@ basic_filebuf<_CharT, _Traits>::__read_mode()
{
if (!(__cm_ & ios_base::in))
{
- this->setp(0, 0);
+ this->setp(nullptr, nullptr);
if (__always_noconv_)
this->setg((char_type*)__extbuf_,
(char_type*)__extbuf_ + __ebs_,
@@ -1112,7 +1112,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
{
if (!(__cm_ & ios_base::out))
{
- this->setg(0, 0, 0);
+ this->setg(nullptr, nullptr, nullptr);
if (__ebs_ > sizeof(__extbuf_min_))
{
if (__always_noconv_)
@@ -1122,7 +1122,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
}
else
- this->setp(0, 0);
+ this->setp(nullptr, nullptr);
__cm_ = ios_base::out;
}
}
@@ -1208,7 +1208,7 @@ inline
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
: basic_istream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode | ios_base::in) == 0)
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
this->setstate(ios_base::failbit);
}
@@ -1218,7 +1218,7 @@ inline
basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
: basic_istream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode | ios_base::in) == 0)
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
@@ -1228,7 +1228,7 @@ inline
basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
: basic_istream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode | ios_base::in) == 0)
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
@@ -1421,7 +1421,7 @@ inline
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
: basic_ostream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode | ios_base::out) == 0)
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
this->setstate(ios_base::failbit);
}
@@ -1431,7 +1431,7 @@ inline
basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
: basic_ostream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode | ios_base::out) == 0)
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
@@ -1441,7 +1441,7 @@ inline
basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
: basic_ostream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode | ios_base::out) == 0)
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
@@ -1550,7 +1550,7 @@ inline
void
basic_ofstream<_CharT, _Traits>::close()
{
- if (__sb_.close() == 0)
+ if (__sb_.close() == nullptr)
this->setstate(ios_base::failbit);
}
@@ -1634,7 +1634,7 @@ inline
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
: basic_iostream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode) == 0)
+ if (__sb_.open(__s, __mode) == nullptr)
this->setstate(ios_base::failbit);
}
@@ -1644,7 +1644,7 @@ inline
basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
: basic_iostream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode) == 0)
+ if (__sb_.open(__s, __mode) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
@@ -1654,7 +1654,7 @@ inline
basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
: basic_iostream<char_type, traits_type>(&__sb_)
{
- if (__sb_.open(__s, __mode) == 0)
+ if (__sb_.open(__s, __mode) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
@@ -1754,7 +1754,7 @@ inline
void
basic_fstream<_CharT, _Traits>::close()
{
- if (__sb_.close() == 0)
+ if (__sb_.close() == nullptr)
this->setstate(ios_base::failbit);
}
diff --git a/libcxx/include/functional b/libcxx/include/functional
index 9a0ca96c4611..0979e7d2bd1d 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -1735,7 +1735,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOE
{
if (__ti == typeid(_Fp))
return &__f_.__target();
- return (const void*)0;
+ return nullptr;
}
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
@@ -1765,11 +1765,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
public:
_LIBCPP_INLINE_VISIBILITY
- __value_func() _NOEXCEPT : __f_(0) {}
+ __value_func() _NOEXCEPT : __f_(nullptr) {}
template <class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a)
- : __f_(0)
+ : __f_(nullptr)
{
typedef allocator_traits<_Alloc> __alloc_traits;
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
@@ -1804,8 +1804,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
_LIBCPP_INLINE_VISIBILITY
__value_func(const __value_func& __f)
{
- if (__f.__f_ == 0)
- __f_ = 0;
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
else if ((void*)__f.__f_ == &__f.__buf_)
{
__f_ = __as_base(&__buf_);
@@ -1818,8 +1818,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
_LIBCPP_INLINE_VISIBILITY
__value_func(__value_func&& __f) _NOEXCEPT
{
- if (__f.__f_ == 0)
- __f_ = 0;
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
else if ((void*)__f.__f_ == &__f.__buf_)
{
__f_ = __as_base(&__buf_);
@@ -1828,7 +1828,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
else
{
__f_ = __f.__f_;
- __f.__f_ = 0;
+ __f.__f_ = nullptr;
}
}
@@ -1845,8 +1845,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
__value_func& operator=(__value_func&& __f)
{
*this = nullptr;
- if (__f.__f_ == 0)
- __f_ = 0;
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
else if ((void*)__f.__f_ == &__f.__buf_)
{
__f_ = __as_base(&__buf_);
@@ -1855,7 +1855,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
else
{
__f_ = __f.__f_;
- __f.__f_ = 0;
+ __f.__f_ = nullptr;
}
return *this;
}
@@ -1864,7 +1864,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
__value_func& operator=(nullptr_t)
{
__func* __f = __f_;
- __f_ = 0;
+ __f_ = nullptr;
if ((void*)__f == &__buf_)
__f->destroy();
else if (__f)
@@ -1875,7 +1875,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
_LIBCPP_INLINE_VISIBILITY
_Rp operator()(_ArgTypes&&... __args) const
{
- if (__f_ == 0)
+ if (__f_ == nullptr)
__throw_bad_function_call();
return (*__f_)(_VSTD::forward<_ArgTypes>(__args)...);
}
@@ -1891,10 +1891,10 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
__func* __t = __as_base(&__tempbuf);
__f_->__clone(__t);
__f_->destroy();
- __f_ = 0;
+ __f_ = nullptr;
__f.__f_->__clone(__as_base(&__buf_));
__f.__f_->destroy();
- __f.__f_ = 0;
+ __f.__f_ = nullptr;
__f_ = __as_base(&__buf_);
__t->__clone(__as_base(&__f.__buf_));
__t->destroy();
@@ -1919,13 +1919,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
}
_LIBCPP_INLINE_VISIBILITY
- _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != 0; }
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != nullptr; }
#ifndef _LIBCPP_NO_RTTI
_LIBCPP_INLINE_VISIBILITY
const std::type_info& target_type() const _NOEXCEPT
{
- if (__f_ == 0)
+ if (__f_ == nullptr)
return typeid(void);
return __f_->target_type();
}
@@ -1933,8 +1933,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
template <typename _Tp>
_LIBCPP_INLINE_VISIBILITY const _Tp* target() const _NOEXCEPT
{
- if (__f_ == 0)
- return 0;
+ if (__f_ == nullptr)
+ return nullptr;
return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
diff --git a/libcxx/include/ios b/libcxx/include/ios
index ae758ddb35ef..653e3a95fc7e 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -710,7 +710,7 @@ void
basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
{
ios_base::init(__sb);
- __tie_ = 0;
+ __tie_ = nullptr;
__fill_ = traits_type::eof();
}
@@ -821,7 +821,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
{
ios_base::move(__rhs);
__tie_ = __rhs.__tie_;
- __rhs.__tie_ = 0;
+ __rhs.__tie_ = nullptr;
__fill_ = __rhs.__fill_;
}
diff --git a/libcxx/include/istream b/libcxx/include/istream
index c541905b2ea2..5e984909f878 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1142,7 +1142,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
+ if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
__state |= ios_base::badbit;
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1179,7 +1179,7 @@ basic_istream<_CharT, _Traits>::unget()
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
+ if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
__state |= ios_base::badbit;
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1215,7 +1215,7 @@ basic_istream<_CharT, _Traits>::sync()
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- if (this->rdbuf() == 0)
+ if (this->rdbuf() == nullptr)
return -1;
if (this->rdbuf()->pubsync() == -1)
{
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index 99f9b8173dbf..d4667d39ddb8 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -512,9 +512,9 @@ struct __has_iterator_category
private:
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::iterator_category* = 0);
+ template <class _Up> static char __test(typename _Up::iterator_category* = nullptr);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(__test<_Tp>(nullptr)) == 1;
};
template <class _Iter, bool> struct __iterator_traits_impl {};
@@ -995,11 +995,11 @@ private:
istream_type* __in_stream_;
_Tp __value_;
public:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
_LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s))
{
if (!(*__in_stream_ >> __value_))
- __in_stream_ = 0;
+ __in_stream_ = nullptr;
}
_LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;}
@@ -1007,7 +1007,7 @@ public:
_LIBCPP_INLINE_VISIBILITY istream_iterator& operator++()
{
if (!(*__in_stream_ >> __value_))
- __in_stream_ = 0;
+ __in_stream_ = nullptr;
return *this;
}
_LIBCPP_INLINE_VISIBILITY istream_iterator operator++(int)
@@ -1067,7 +1067,7 @@ private:
const char_type* __delim_;
public:
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) _NOEXCEPT
- : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {}
+ : __out_stream_(_VSTD::addressof(__s)), __delim_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
: __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
@@ -1113,11 +1113,11 @@ private:
bool __test_for_eof() const
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
- __sbuf_ = 0;
- return __sbuf_ == 0;
+ __sbuf_ = nullptr;
+ return __sbuf_ == nullptr;
}
public:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
@@ -1182,13 +1182,13 @@ public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
- __sbuf_ = 0;
+ __sbuf_ = nullptr;
return *this;
}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
- _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
+ _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == nullptr;}
template <class _Ch, class _Tr>
friend
@@ -1441,7 +1441,7 @@ public:
}
template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
__wrap_iter(const __wrap_iter<_Up>& __u,
- typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
+ typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT
: __i(__u.base())
{
#if _LIBCPP_DEBUG_LEVEL == 2
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 2723c0cfea66..80a5134fdb2e 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -257,11 +257,11 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
const unsigned char __does_match = '\2';
unsigned char __statbuf[100];
unsigned char* __status = __statbuf;
- unique_ptr<unsigned char, void(*)(void*)> __stat_hold(0, free);
+ unique_ptr<unsigned char, void(*)(void*)> __stat_hold(nullptr, free);
if (__nkw > sizeof(__statbuf))
{
__status = (unsigned char*)malloc(__nkw);
- if (__status == 0)
+ if (__status == nullptr)
__throw_bad_alloc();
__stat_hold.reset(__status);
}
@@ -1560,14 +1560,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
(int)__iob.precision(), __v);
else
__nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- unique_ptr<char, void(*)(void*)> __nbh(0, free);
+ unique_ptr<char, void(*)(void*)> __nbh(nullptr, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
else
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- if (__nb == 0)
+ if (__nb == nullptr)
__throw_bad_alloc();
__nbh.reset(__nb);
}
@@ -1611,14 +1611,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
(int)__iob.precision(), __v);
else
__nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- unique_ptr<char, void(*)(void*)> __nbh(0, free);
+ unique_ptr<char, void(*)(void*)> __nbh(nullptr, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
else
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- if (__nb == 0)
+ if (__nb == nullptr)
__throw_bad_alloc();
__nbh.reset(__nb);
}
@@ -3104,11 +3104,11 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
__ct.widen(__src, __src + (sizeof(__src)-1), __atoms);
char __nbuf[__bz];
char* __nc = __nbuf;
- unique_ptr<char, void(*)(void*)> __h(0, free);
+ unique_ptr<char, void(*)(void*)> __h(nullptr, free);
if (__wn - __wb.get() > __bz-2)
{
__h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
- if (__h.get() == 0)
+ if (__h.get() == nullptr)
__throw_bad_alloc();
__nc = __h.get();
}
@@ -3393,13 +3393,13 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char_type __digits[__bs];
char_type* __db = __digits;
size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units));
- unique_ptr<char, void(*)(void*)> __hn(0, free);
+ unique_ptr<char, void(*)(void*)> __hn(nullptr, free);
unique_ptr<char_type, void(*)(void*)> __hd(0, free);
// secure memory for digit storage
if (__n > __bs-1)
{
__n = static_cast<size_t>(__libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
- if (__bb == 0)
+ if (__bb == nullptr)
__throw_bad_alloc();
__hn.reset(__bb);
__hd.reset((char_type*)malloc(__n * sizeof(char_type)));
@@ -3919,7 +3919,7 @@ private:
wbuffer_convert(const wbuffer_convert&);
wbuffer_convert& operator=(const wbuffer_convert&);
public:
- _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
+ _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = nullptr,
_Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
~wbuffer_convert();
@@ -3957,9 +3957,9 @@ private:
template <class _Codecvt, class _Elem, class _Tr>
wbuffer_convert<_Codecvt, _Elem, _Tr>::
wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
- : __extbuf_(0),
- __extbufnext_(0),
- __extbufend_(0),
+ : __extbuf_(nullptr),
+ __extbufnext_(nullptr),
+ __extbufend_(nullptr),
__ebs_(0),
__intbuf_(0),
__ibs_(0),
@@ -4332,12 +4332,12 @@ template <class _Codecvt, class _Elem, class _Tr>
wbuffer_convert<_Codecvt, _Elem, _Tr>*
wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
{
- wbuffer_convert* __rt = 0;
- if (__cv_ != 0 && __bufptr_ != 0)
+ wbuffer_convert* __rt = nullptr;
+ if (__cv_ != nullptr && __bufptr_ != nullptr)
{
__rt = this;
if ((__cm_ & ios_base::out) && sync())
- __rt = 0;
+ __rt = nullptr;
}
return __rt;
}
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 52636e9d6835..f42f03f53f80 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -1912,7 +1912,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _Tp* release() _NOEXCEPT
{
_Tp* __t = __ptr_;
- __ptr_ = 0;
+ __ptr_ = nullptr;
return __t;
}
_LIBCPP_INLINE_VISIBILITY void reset(_Tp* __p = 0) _NOEXCEPT
@@ -2853,7 +2853,7 @@ public:
: __size_(__s) {}
template <class _Tp>
- _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY void __incr() _NOEXCEPT
{__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
template <class _Tp>
@@ -3545,7 +3545,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool unique() const _NOEXCEPT {return use_count() == 1;}
_LIBCPP_INLINE_VISIBILITY
- _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != nullptr;}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT
@@ -3649,8 +3649,8 @@ template<class _Tp>
inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
- : __ptr_(0),
- __cntrl_(0)
+ : __ptr_(nullptr),
+ __cntrl_(nullptr)
{
}
@@ -3658,8 +3658,8 @@ template<class _Tp>
inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
- : __ptr_(0),
- __cntrl_(0)
+ : __ptr_(nullptr),
+ __cntrl_(nullptr)
{
}
@@ -3704,7 +3704,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d,
template<class _Tp>
template<class _Dp>
shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
- : __ptr_(0)
+ : __ptr_(nullptr)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -3755,7 +3755,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
template<class _Tp>
template<class _Dp, class _Alloc>
shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
- : __ptr_(0)
+ : __ptr_(nullptr)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -3819,8 +3819,8 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{
- __r.__ptr_ = 0;
- __r.__cntrl_ = 0;
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
}
template<class _Tp>
@@ -3832,8 +3832,8 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{
- __r.__ptr_ = 0;
- __r.__cntrl_ = 0;
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
}
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
@@ -4368,7 +4368,7 @@ public:
{return __cntrl_ ? __cntrl_->use_count() : 0;}
_LIBCPP_INLINE_VISIBILITY
bool expired() const _NOEXCEPT
- {return __cntrl_ == 0 || __cntrl_->use_count() == 0;}
+ {return __cntrl_ == nullptr || __cntrl_->use_count() == 0;}
shared_ptr<_Tp> lock() const _NOEXCEPT;
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
@@ -4392,8 +4392,8 @@ template<class _Tp>
inline
_LIBCPP_CONSTEXPR
weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
- : __ptr_(0),
- __cntrl_(0)
+ : __ptr_(nullptr),
+ __cntrl_(nullptr)
{
}
@@ -4439,8 +4439,8 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{
- __r.__ptr_ = 0;
- __r.__cntrl_ = 0;
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
}
template<class _Tp>
@@ -4452,8 +4452,8 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{
- __r.__ptr_ = 0;
- __r.__cntrl_ = 0;
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
}
template<class _Tp>
@@ -4555,7 +4555,7 @@ shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r,
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_)
{
- if (__cntrl_ == 0)
+ if (__cntrl_ == nullptr)
__throw_bad_weak_ptr();
}
diff --git a/libcxx/include/regex b/libcxx/include/regex
index e4868af92f5f..028831d72e0b 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -2574,12 +2574,12 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex()
: __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(0)
+ __end_(nullptr)
{}
_LIBCPP_INLINE_VISIBILITY
explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(0)
+ __end_(nullptr)
{
__init(__p, __p + __traits_.length(__p));
}
@@ -2587,7 +2587,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(0)
+ __end_(nullptr)
{
__init(__p, __p + __len);
}
@@ -2599,7 +2599,7 @@ public:
explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(0)
+ __end_(nullptr)
{
__init(__p.begin(), __p.end());
}
@@ -2609,7 +2609,7 @@ public:
basic_regex(_ForwardIterator __first, _ForwardIterator __last,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(0)
+ __end_(nullptr)
{
__init(__first, __last);
}
@@ -2618,7 +2618,7 @@ public:
basic_regex(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(0)
+ __end_(nullptr)
{
__init(__il.begin(), __il.end());
}
diff --git a/libcxx/include/sstream b/libcxx/include/sstream
index 1439d9c4ab9c..22cc0c350384 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -210,13 +210,13 @@ public:
// 27.8.1.1 Constructors:
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __hm_(0), __mode_(__wch)
+ : __hm_(nullptr), __mode_(__wch)
{ }
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringbuf(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(__s.get_allocator()), __hm_(0), __mode_(__wch)
+ : __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch)
{
str(__s);
}
@@ -440,7 +440,7 @@ void
basic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{
__str_ = __s;
- __hm_ = 0;
+ __hm_ = nullptr;
if (__mode_ & ios_base::in)
{
__hm_ = const_cast<char_type*>(__str_.data()) + __str_.size();
@@ -587,9 +587,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
return pos_type(-1);
if (__noff != 0)
{
- if ((__wch & ios_base::in) && this->gptr() == 0)
+ if ((__wch & ios_base::in) && this->gptr() == nullptr)
return pos_type(-1);
- if ((__wch & ios_base::out) && this->pptr() == 0)
+ if ((__wch & ios_base::out) && this->pptr() == nullptr)
return pos_type(-1);
}
if (__wch & ios_base::in)
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index 193b7e5ae8a6..0dfa31449b90 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -308,12 +308,12 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf()
template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>::basic_streambuf()
- : __binp_(0),
- __ninp_(0),
- __einp_(0),
- __bout_(0),
- __nout_(0),
- __eout_(0)
+ : __binp_(nullptr),
+ __ninp_(nullptr),
+ __einp_(nullptr),
+ __bout_(nullptr),
+ __nout_(nullptr),
+ __eout_(nullptr)
{
}
diff --git a/libcxx/include/string b/libcxx/include/string
index d3e53592f5f1..1f3f444727fd 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -449,15 +449,15 @@ typedef basic_string<wchar_t> wstring;
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
-int stoi (const string& str, size_t* idx = 0, int base = 10);
-long stol (const string& str, size_t* idx = 0, int base = 10);
-unsigned long stoul (const string& str, size_t* idx = 0, int base = 10);
-long long stoll (const string& str, size_t* idx = 0, int base = 10);
-unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
+int stoi (const string& str, size_t* idx = nullptr, int base = 10);
+long stol (const string& str, size_t* idx = nullptr, int base = 10);
+unsigned long stoul (const string& str, size_t* idx = nullptr, int base = 10);
+long long stoll (const string& str, size_t* idx = nullptr, int base = 10);
+unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
-float stof (const string& str, size_t* idx = 0);
-double stod (const string& str, size_t* idx = 0);
-long double stold(const string& str, size_t* idx = 0);
+float stof (const string& str, size_t* idx = nullptr);
+double stod (const string& str, size_t* idx = nullptr);
+long double stold(const string& str, size_t* idx = nullptr);
string to_string(int val);
string to_string(unsigned val);
@@ -469,15 +469,15 @@ string to_string(float val);
string to_string(double val);
string to_string(long double val);
-int stoi (const wstring& str, size_t* idx = 0, int base = 10);
-long stol (const wstring& str, size_t* idx = 0, int base = 10);
-unsigned long stoul (const wstring& str, size_t* idx = 0, int base = 10);
-long long stoll (const wstring& str, size_t* idx = 0, int base = 10);
-unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
+int stoi (const wstring& str, size_t* idx = nullptr, int base = 10);
+long stol (const wstring& str, size_t* idx = nullptr, int base = 10);
+unsigned long stoul (const wstring& str, size_t* idx = nullptr, int base = 10);
+long long stoll (const wstring& str, size_t* idx = nullptr, int base = 10);
+unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
-float stof (const wstring& str, size_t* idx = 0);
-double stod (const wstring& str, size_t* idx = 0);
-long double stold(const wstring& str, size_t* idx = 0);
+float stof (const wstring& str, size_t* idx = nullptr);
+double stod (const wstring& str, size_t* idx = nullptr);
+long double stold(const wstring& str, size_t* idx = nullptr);
wstring to_wstring(int val);
wstring to_wstring(unsigned val);
@@ -3965,7 +3965,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
return false;
if (capacity() < __min_cap - 1)
return false;
- if (data() == 0)
+ if (data() == nullptr)
return false;
if (data()[size()] != value_type())
return false;
@@ -4336,15 +4336,15 @@ typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
-_LIBCPP_FUNC_VIS int stoi (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long stol (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long stoul (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long long stoll (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS int stoi (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long stol (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long stoul (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long long stoll (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_FUNC_VIS float stof (const string& __str, size_t* __idx = 0);
-_LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = 0);
-_LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS float stof (const string& __str, size_t* __idx = nullptr);
+_LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = nullptr);
+_LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = nullptr);
_LIBCPP_FUNC_VIS string to_string(int __val);
_LIBCPP_FUNC_VIS string to_string(unsigned __val);
@@ -4356,15 +4356,15 @@ _LIBCPP_FUNC_VIS string to_string(float __val);
_LIBCPP_FUNC_VIS string to_string(double __val);
_LIBCPP_FUNC_VIS string to_string(long double __val);
-_LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long long stoll (const wstring& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long long stoll (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_FUNC_VIS float stof (const wstring& __str, size_t* __idx = 0);
-_LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = 0);
-_LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS float stof (const wstring& __str, size_t* __idx = nullptr);
+_LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = nullptr);
+_LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = nullptr);
_LIBCPP_FUNC_VIS wstring to_wstring(int __val);
_LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val);
diff --git a/libcxx/include/strstream b/libcxx/include/strstream
index 31999bbae14b..6b893eebd00b 100644
--- a/libcxx/include/strstream
+++ b/libcxx/include/strstream
@@ -19,12 +19,12 @@ class strstreambuf
public:
explicit strstreambuf(streamsize alsize_arg = 0);
strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
- strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
+ strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
strstreambuf(const char* gnext_arg, streamsize n);
- strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0);
+ strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr);
strstreambuf(const signed char* gnext_arg, streamsize n);
- strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0);
+ strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr);
strstreambuf(const unsigned char* gnext_arg, streamsize n);
strstreambuf(strstreambuf&& rhs);
@@ -142,12 +142,12 @@ class _LIBCPP_TYPE_VIS strstreambuf
public:
explicit strstreambuf(streamsize __alsize = 0);
strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
- strstreambuf(char* __gnext, streamsize __n, char* __pbeg = 0);
+ strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
strstreambuf(const char* __gnext, streamsize __n);
- strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = 0);
+ strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
strstreambuf(const signed char* __gnext, streamsize __n);
- strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
+ strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/system_error b/libcxx/include/system_error
index 74e889aa9ac7..b714e1d4263d 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -253,7 +253,7 @@ public:
template <class _Ep>
_LIBCPP_INLINE_VISIBILITY
error_condition(_Ep __e,
- typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
+ typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr
) _NOEXCEPT
{*this = make_error_condition(__e);}
@@ -325,7 +325,7 @@ public:
template <class _Ep>
_LIBCPP_INLINE_VISIBILITY
error_code(_Ep __e,
- typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
+ typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr
) _NOEXCEPT
{*this = make_error_code(__e);}
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 4bbd5ed323af..aaae6fbd5b3f 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -802,7 +802,7 @@ private:
public:
// construct/destroy:
_LIBCPP_INLINE_VISIBILITY
- valarray() : __begin_(0), __end_(0) {}
+ valarray() : __begin_(nullptr), __end_(nullptr) {}
inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
explicit valarray(size_t __n);
_LIBCPP_INLINE_VISIBILITY
@@ -2750,8 +2750,8 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
template <class _Tp>
inline
valarray<_Tp>::valarray(size_t __n)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
if (__n)
{
@@ -2776,16 +2776,16 @@ valarray<_Tp>::valarray(size_t __n)
template <class _Tp>
inline
valarray<_Tp>::valarray(const value_type& __x, size_t __n)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
resize(__n, __x);
}
template <class _Tp>
valarray<_Tp>::valarray(const value_type* __p, size_t __n)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
if (__n)
{
@@ -2809,8 +2809,8 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n)
template <class _Tp>
valarray<_Tp>::valarray(const valarray& __v)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
if (__v.size())
{
@@ -2845,8 +2845,8 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
template <class _Tp>
valarray<_Tp>::valarray(initializer_list<value_type> __il)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
const size_t __n = __il.size();
if (__n)
@@ -2874,8 +2874,8 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il)
template <class _Tp>
valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
const size_t __n = __sa.__size_;
if (__n)
@@ -2901,8 +2901,8 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
template <class _Tp>
valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
const size_t __n = __ga.__1d_.size();
if (__n)
@@ -2930,8 +2930,8 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
template <class _Tp>
valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
const size_t __n = __ma.__1d_.size();
if (__n)
@@ -2959,8 +2959,8 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
template <class _Tp>
valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
- : __begin_(0),
- __end_(0)
+ : __begin_(nullptr),
+ __end_(nullptr)
{
const size_t __n = __ia.__1d_.size();
if (__n)
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 57f948fbb052..8bdaf13cf953 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -64,7 +64,7 @@ operator new(std::size_t size) _THROW_BAD_ALLOC
if (size == 0)
size = 1;
void* p;
- while ((p = ::malloc(size)) == 0)
+ while ((p = ::malloc(size)) == nullptr)
{
// If malloc fails and there is a new_handler,
// call it to try free up memory.
@@ -85,7 +85,7 @@ _LIBCPP_WEAK
void*
operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
{
- void* p = 0;
+ void* p = nullptr;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
@@ -111,7 +111,7 @@ _LIBCPP_WEAK
void*
operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
{
- void* p = 0;
+ void* p = nullptr;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
@@ -207,7 +207,7 @@ _LIBCPP_WEAK
void*
operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
{
- void* p = 0;
+ void* p = nullptr;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
@@ -233,7 +233,7 @@ _LIBCPP_WEAK
void*
operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
{
- void* p = 0;
+ void* p = nullptr;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{