   assignment of reference to consts
  Sorry, for asking a basic question but I'm confused about why the following to cases aren't analogous:Foo foo; const Foo* const_foo_ptr1 = &foo;const Foo* const_foo_ptr2 = 0;const_foo_ptr2 = const_foo_ptr1;  // <- (1) This is fine...    const Foo& const_foo_ref1 = foo;const Foo& const_foo_ref2 = Foo();const_foo_ref2 =  const_foo_ref1; // <- (2) This isn't...(2) is giving me an error basically saying that there is no assignment operator with a const Foo& on the left side.The way I understand it const Foo& ref = bar means "I can't use ref to mutate bar" and not "ref can't be assigned to anything besides bar". Could someone clear this up?   
  references can't be reassigned after they are created, regardless of their const status.;Quote:Original post by phantomreferences can't be reassigned after they are created, regardless of their const status.Yeah, that rings a bell. However, if i drop the consts on the references the above will compile under VS 2008. What's up with that?EDIT: oh nevermind I figured out what's going on...   ;Quote:Original post by jwezorekQuote:Original post by phantomreferences can't be reassigned after they are created, regardless of their const status.Yeah, that rings a bell. However, if i drop the consts on the references the above will compile under VS 2008. What's up with that?EDIT: oh nevermind I figured out what's going on...And for the benefit of those reading this thread later, what you will have realised is that it's performing copy-assignment on the referenced objects in that case.   ;Quote:Original post by iMalcQuote:Original post by jwezorekQuote:Original post by phantomreferences can't be reassigned after they are created, regardless of their const status.Yeah, that rings a bell. However, if i drop the consts on the references the above will compile under VS 2008. What's up with that?EDIT: oh nevermind I figured out what's going on...And for the benefit of those reading this thread later, what you will have realised is that it's performing copy-assignment on the referenced objects in that case.Right, it's just doing the copy. I was having a brain fart there.   