[comp.lang.c++] variable number of args & pass by reference

sullivan@june.cs.washington.edu (Kevin Sullivan) (11/29/88)

I want a subroutine to take a variable number of arguments and for those
arguments to be passed as references:

Frame::Frame(Point& p, Vector& ...)

Where "..." means any number of Vector&s.  It doesn't look like this
is possible.  The Point& argument and the first Vector& argument are
passed as references, but the rest of the Vector arguments are passed
by value (judging by a stack backtrace.)

My question is: is there any way to have the arguments falling under
the "..." passed as references.  Seems like no, but maybe there is
someone out there who knows for sure.

Thanks a lot.


-- 
--------
Kevin Sullivan, sullivan@cs.washington.edu,
Department of Computer Science, Sieg Hall FR-35, 
University of Washington, Seattle, WA 98195 (206) 543-1695

ark@alice.UUCP (Andrew Koenig) (11/29/88)

In article <6541@june.cs.washington.edu>, sullivan@june.cs.washington.edu (Kevin Sullivan) writes:

> My question is: is there any way to have the arguments falling under
> the "..." passed as references.  Seems like no, but maybe there is
> someone out there who knows for sure.

You're right -- there's no way to do it.  The trouble is that
by saying `...' you are disclaiming all knowledge of the types
of the arguments.  Thus you can't simultaneously say they're
references: that would require knowledge of their types.
-- 
				--Andrew Koenig
				  ark@europa.att.com