Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: question on...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 13 Topic 43800 of 48417
Post > Topic >>

Re: question on list<int&>

by James Kanze <james.kanze@[EMAIL PROTECTED] > Mar 13, 2008 at 06:23 AM

On Mar 13, 11:33 am, Kai-Uwe Bux <jkherci...@[EMAIL PROTECTED]
> wrote:
> James Kanze wrote many things I agree with and this:

> > On Mar 12, 8:28 pm, Kai-Uwe Bux <jkherci...@[EMAIL PROTECTED]
> wrote:
> [snip]
> >> The Assignable concept for type T only requires that if
> >> a and b have type T, the expression a =3D b has the type T& and
> >> the postcondition that a is "equivalent" to b (think a =3D=3D b).

> > I don't think so.  The standard is (intentionally) very vague on
> > what is meant by "equivalent", but it does make the requirement
> > of equivalence for both assignment and copy construction.  And
> > while one can argue that either copy construction or assignment
> > results in equivalence in the case of references, it seems to me
> > that the exact meaning of equivalence is not the same in the two
> > cases.  When you chose one for the definition you want to use in
> > specifying the concepts, you find that references don't
> > correctly implement the semantics of the other.

> Just for clarification: You mean that the postcondition after
> copy construction

>   T & lhs ( rhs );

> is &lhs =3D=3D &rhs and after assignment

>   lhs =3D rhs

> it is lhs =3D=3D rhs?

More or less.  (Of course, if &lhs =3D=3D &rhs, then lhs =3D=3D rhs.
Even if you modify one of them in the future:-).)  But I didn't
want to express it too much strictly in terms of =3D=3D, since that
might not even be implemented.  The idea is just that the copy
constructor copies the reference, where as the assignment
operator copies the referred to object, and those are two
radically different semantics, which take a different view of
"copy" (and thus, of the "equivalence" of the results).

In the end, the standard says that containers are objects which
contain other objects, and references aren't objects.  I don't
think you have to delve into the details of what is meant by
each required concept (which is necessarily vague when you start
talking about the equivalence of two objects after an operation)
to say that containers of references aren't sup****ted.

--
James Kanze (GABI Software)             email:james.kanze@[EMAIL PROTECTED]
 en informatique orient=E9e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
 




 13 Posts in Topic:
question on list
"subramanian100in@[E  2008-03-10 22:48:40 
Re: question on list
Ian Collins <ian-news@  2008-03-11 18:54:00 
Re: question on list
Kai-Uwe Bux <jkherciue  2008-03-11 04:50:20 
Re: question on list
Ron Natalie <ron@[EMAI  2008-03-12 10:35:13 
Re: question on list
Ian Collins <ian-news@  2008-03-13 08:05:05 
Re: question on list
Kai-Uwe Bux <jkherciue  2008-03-12 15:28:12 
Re: question on list
Ron Natalie <ron@[EMAI  2008-03-12 20:05:17 
Re: question on list
James Kanze <james.kan  2008-03-13 03:04:11 
Re: question on list
Ian Collins <ian-news@  2008-03-14 08:42:58 
Re: question on list
James Kanze <james.kan  2008-03-13 03:21:36 
Re: question on list
Kai-Uwe Bux <jkherciue  2008-03-13 06:33:41 
Re: question on list
James Kanze <james.kan  2008-03-13 03:24:48 
Re: question on list
James Kanze <james.kan  2008-03-13 06:23:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 10:03:06 CST 2008.