freyc / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Need a polymorphic NULL pointer that can be used in function templates #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
C++ often requires you to explicitly cast NULL to a specific type when it
is used to invoke a function template, which is tedious.  We can add the
following class:

class Null {
 public:
  template <typename T>
  operator T*() const { return NULL; }
};

Then the user should be able to write Null() wherever a NULL pointer is
expected, even when invoking a templatized function.

Original issue reported on code.google.com by shiq...@gmail.com on 8 Oct 2008 at 9:35

GoogleCodeExporter commented 9 years ago
This doesn't seem to belong to gtest.

Original comment by zhanyong...@gmail.com on 22 Feb 2009 at 5:47