home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!siena!mittle
- From: mittle@watson.ibm.com (Josh Mittleman)
- Subject: Re: Overloading in the presence of ellipsis
- Sender: news@watson.ibm.com (NNTP News Poster)
- Message-ID: <1992Aug27.174335.38947@watson.ibm.com>
- Date: Thu, 27 Aug 1992 17:43:35 GMT
- Disclaimer: This posting represents the poster's views, not necessarily those of IBM
- References: <1992Aug22.122940.12580@lut.ac.uk> <1992Aug27.115621.23359@lut.ac.uk> <1992Aug27.164855.17882@lgc.com>
- Nntp-Posting-Host: siena.watson.ibm.com
- Organization: IBM T.J. Watson Research Center
- Lines: 18
-
- srinivas@lgc.com (Manapragada Srinivas) writes:
-
- > If I overload a function in the following way
- >
- > foo( int ) { cout << "non ellipsis version" << endl; }
- >
- > foo( int ... ) { cout << "ellipsis version" << endl; }
- >
- > main() { foo(1); }
-
- Then you are out of luck: foo(1) matches both versions exactly.
- foo(int, ...) exactly matches any call of foo where the first argument is
- an int: It is "int followed by any number of arguments," not "int followed
- by one or more arguments".
-
- ===========================================================================
- Josh Mittleman (mittle@watson.ibm.com)
- J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY 10598
-