Re: How to eliminate assignment operator generation warning
- From: "Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx>
- Date: Sat, 23 Jul 2005 10:30:49 -0700
Tron Thomas wrote:
> What is the reason the reference variable m_value cannot be copied?
> As far as I know there should be no problem with this. It is
> perfectly legal to do the following:
References cannot be copied. Ever.
>
> int value = 42;
> int& first = value
> int& second = first; // copy of the first reference
Not really a copy of the first reference, but a new reference to 'value'.
Here's the case that matters though:
int value;
int& first = value;
int other;
int& second = other;
// legal, but doesn't assign the reference
// instead, 'other' is set to the same value as 'value'.
second = first;
-cd
.
- Follow-Ups:
- Re: How to eliminate assignment operator generation warning
- From: Tron Thomas
- Re: How to eliminate assignment operator generation warning
- References:
- Re: How to eliminate assignment operator generation warning
- From: David Lowndes
- Re: How to eliminate assignment operator generation warning
- From: Tron Thomas
- Re: How to eliminate assignment operator generation warning
- Prev by Date: Re: How to eliminate assignment operator generation warning
- Next by Date: Re: How to eliminate assignment operator generation warning
- Previous by thread: Re: How to eliminate assignment operator generation warning
- Next by thread: Re: How to eliminate assignment operator generation warning
- Index(es):
Relevant Pages
|