Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!apple!netcom!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Distinguishing lvalue/rvalue operator[] Message-ID: <1991Mar4.054915.19566@mathcs.sjsu.edu> Date: 4 Mar 91 05:49:15 GMT References: <1991Mar3.202134.17812@mathcs.sjsu.edu> Organization: San Jose State University - Math/CS Dept. Lines: 13 I was thinking more about Joe Buck's suggestion to make the distinction of lvalue/rvalue operator[] by returning an access class, and found another snag. Suppose you have a variable size integer array and have operator[] return an instance of class Access with functions Access::operator=(int) Access::operator int as suggested. Then the statement a[i]++ will not execute. Really, to preserve the "look and feel" of the standard operator[], it seems that it must return a reference. Or is there some clever way to overcome this problem? Cay