Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!rice!zamenhof.rice.edu From: dougm@zamenhof.rice.edu (Doug Moore) Newsgroups: comp.lang.c++ Subject: operator []: ref vs value Message-ID: <5216@brazos.Rice.edu> Date: 22 Feb 90 16:36:38 GMT Sender: root@rice.edu Organization: Rice University, Houston Lines: 12 I can't seem to find a way to do precisely what I want; I want a sparse vector data type. I can declare a float-returning operator [] that returns 0.0 if the array index corresponds to a row for which no nonzero is stored. I can declare a reference-to-float-returning operator[] that creates a new entry in my linked list of nonzero values when the row has no corresponding nonzero stored. Unfortunately, I want one behavior when the pseudo-array access occurs as an rvalue and another when it appears as an lvalue. Can I get what I want? Dougm