[libc++] Replace several uses of 0 by nullptr

Differential Revision: https://reviews.llvm.org/D43159
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 4e1afe6..f047ae1 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -3405,7 +3405,7 @@
         // 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 @@
             else
             {
                 ::new(__t) value_type(_VSTD::move(*__i));
-                __d.__incr((value_type*)0);
+                __d.template __incr<value_type>();
                 ++__t;
             }
         }
@@ -3535,7 +3535,7 @@
         // 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 @@
             else
             {
                 ::new(__t) value_type(_VSTD::move(*__i));
-                __d.__incr((value_type*)0);
+                __d.template __incr<value_type>();
                 ++__t;
             }
         }
@@ -3923,7 +3923,7 @@
         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 @@
             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 @@
             else
             {
                 ::new(__j2) value_type(_VSTD::move(*__first1));
-                __d.__incr((value_type*)0);
+                __d.template __incr<value_type>();
             }
         }
         __h.release();
@@ -4481,14 +4481,14 @@
     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 @@
     {
         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 @@
         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 @@
         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 @@
         __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),