[libcxx-commits] [PATCH] D63053: Add nullptr output operator overload (2221)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 10 19:59:03 PDT 2019


zoecarver added inline comments.


================
Comment at: include/ostream:223
+    basic_ostream& operator<<(nullptr_t)
+    { return *this << static_cast<const char*>("nullptr\0"); }
+
----------------
mclow.lists wrote:
> Don't need the `\0`; the compiler does that for you. 
> Nor the static cast; the type of a string literal is `const char *` already.
> Just say:
>     { return *this << "nullptr"; }
🤦‍♂️but I liked the `static_cast` so much \s.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63053/new/

https://reviews.llvm.org/D63053





More information about the libcxx-commits mailing list