Skip to content

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

@GoogleCodeExporter

Description

@GoogleCodeExporter
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions