Topic: operator= and table in ARM Ch.12 (Special Member Funcs")


Author: pchandr@newsit.ecte.uswc.uswest.com (Periannan Chandrasekaran)
Date: Tue, 1 Nov 1994 19:36:24 GMT
Raw View

At the end of Chapter 12 (Special Member Functions) of the ARM,
there is a table listing various special member functions and
their characteristics like whether inheritable, generated by default etc.

It was confusing to see two entries for =.


name    inherited   can be     can have       member or      generated by
                    virtual?   return type?    friend          default?
------  ---------   ---------  ------------   -------------   ------------
 =      no          yes         yes             member         yes

op=     yes         yes         yes            either          no



Can somebody clarify this?


thanks,
chandra




Author: jason@cygnus.com (Jason Merrill)
Date: Wed, 2 Nov 1994 01:19:03 GMT
Raw View
>>>>> Periannan Chandrasekaran <pchandr@newsit.ecte.uswc.uswest.com> writes:

> At the end of Chapter 12 (Special Member Functions) of the ARM,
> there is a table listing various special member functions and
> their characteristics like whether inheritable, generated by default etc.

> It was confusing to see two entries for =.

Yep, that had me confused for a while.

> name    inherited   can be     can have       member or      generated by
>                     virtual?   return type?    friend          default?
> ------  ---------   ---------  ------------   -------------   ------------
>  =      no          yes         yes             member         yes

> op=     yes         yes         yes            either          no

Here, 'op=' is a cryptic shorthand for '+=, -=, /=, ...', NOT for 'operator='.

Jason




Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 2 Nov 1994 13:40:00 GMT
Raw View
pchandr@newsit.ecte.uswc.uswest.com (Periannan Chandrasekaran) writes:



>At the end of Chapter 12 (Special Member Functions) of the ARM,
>there is a table listing various special member functions and
>their characteristics like whether inheritable, generated by default etc.

>It was confusing to see two entries for =.

>name    inherited   can be     can have       member or      generated by
>                    virtual?   return type?    friend          default?
>------  ---------   ---------  ------------   -------------   ------------
> =      no          yes         yes             member         yes

>op=     yes         yes         yes            either          no


>Can somebody clarify this?


The first entry "=" refers to the assignment operator, as in "x = y".

The second "op=" refers to any of the compound assignment operations,
such as "x += y" or "x /= y".
--
Steve Clamage, stephen.clamage@eng.sun.com