From -6921282961918613754
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,f86cdbd4280bf4a1
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-11-10 19:52:26 PST
Newsgroups: comp.std.c++
Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!ix.netcom.com!netcom.com!smeyers
From: smeyers@netcom.com (Scott Meyers)
Subject: Re: Bytes and Characters
Message-ID: <smeyersCz2J5M.8yt@netcom.com>
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
References: <KANZE.94Oct26220005@slsvhdt.us-es.sel.de> <39a79t$87h@tethys.otol.fi> <KANZE.94Nov8192744@slsvhdt.us-es.sel.de>
Date: Thu, 10 Nov 1994 20:20:09 GMT
Lines: 35

In article <KANZE.94Nov8192744@slsvhdt.us-es.sel.de> kanze@us-es.sel.de (James Kanze US/ESC 60/3/164 #71425) writes:
| One of the reasons given for not accepting the proposal was that it
| could be simulated by a template class, something along the lines of:
| 
| 	template< class T >
| 	class Nil
| 	{
| 	public :
| 	    operator T*() { return 0 ; }
| 	} ;
| 
| and then writing things like:
| 
| 	char* p = Nil< char >() ;

In Effective C++, I considered this possibility:

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

  const Null NULL;

Then you should be able to do:

  char *p = NULL;

At the time, templates were only allowed at global scope.  Now that member
function templates are allowed, perhaps it's worth revisiting this idea.
It seems as valid as the smart-pointer conversion trick that Bjarne
describes in section 15.9.1 of his DEC++ book.

Scott


