home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!stanford.edu!EE.Stanford.EDU!sierra!mcgrant
- From: mcgrant@rascals.stanford.edu (Michael C. Grant)
- Subject: Re: zero-length datatype
- In-Reply-To: jbn@lulea.trab.se's message of 9 Sep 92 19:58:05 GMT
- Message-ID: <MCGRANT.92Sep10142012@rascals.stanford.edu>
- Sender: usenet@EE.Stanford.EDU (Usenet)
- Organization: Information Systems Laboratory, Stanford University
- References: <TMB.92Sep8141523@arolla.idiap.ch> <4947@holden.lulea.trab.se>
- Distribution: comp
- Date: 10 Sep 92 14:20:12
- Lines: 33
-
-
- tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
- : In article <MCGRANT.92Sep7142456@rascals.stanford.edu> mcgrant@rascals.stanford.edu (Michael C. Grant) writes:
- :
- : I don't understand why those 4 bytes are causing you such a stink. Perhaps
- : you could enlighten us as to why a truly zero length data type is even
- : necessary?
- :
- : Under the current rules,
- :
- : struct nothing {};
- : HashTable<int,nothing> table(1000000);
- :
- : table takes up 8Mbytes (on most machines). If you could write
- :
- : HashTable<int,void> table(1000000);
- :
- : table takes up 4Mbytes.
-
- That wasn't my question... I would like an example where I would need to
- USE a void data type. In other words, Why is HashTable<int,void> a useful
- data type at all, and why can't we simply share code between
- HashTable<T1,T2> and another template HashTable<T1> which would be
- functionally equivalent to HashTable<T1,void>?
-
- Perhaps, in fact, HashTable<T1> could be a base class for HashTable<T1,T2>,
- so as to maximize the possible code reuse...
-
- I don't understand why a well-written C++ program should need to
- operate on data that does not exist. If you give me a good example,
- I would appreciate it.
-
- Michael C. Grant
-