List:MySQL++« Previous MessageNext Message »
From:Jonathan Wakely Date:February 20 2007 2:31pm
Subject:Re: Two bugs in 2.2.0
View as plain text  
On 20/02/07, Joseph Artsimovich <joseph@stripped> wrote:
> > So what?
> > The temporary is guaranteed to exist as long as the reference is in scope.
> >
> > See 12.2 paragraph 5 in the C++ standard.
> I don't have access to C++ standard, but a simple test shows you are right.
> Then your solution is obviously better than mine.
>

it's an extremely useful feature.

4 There are two contexts in which temporaries are destroyed at a
different point than the end of the full expression. The first context
is when [...].
5 The second context is when a reference is bound to a temporary. The
temporary to which the reference is bound [...] persists for the
lifetime of the reference [...]

I use it whenever I call a function that returns a class type by value
and I only want const access to the returned value, as it avoids a
copy.

jon
Thread
Two bugs in 2.2.0Joseph Artsimovich12 Feb
  • Column sizesgary clark12 Feb
    • Re: Column sizesWarren Young13 Feb
      • Re: Column sizesgary clark16 Feb
        • Re: Column sizesWarren Young16 Feb
          • Re: Column sizesgary clark16 Feb
            • UPDATE routine giving exceptiongary clark16 Feb
              • Re: UPDATE routine giving exceptionJonathan Wakely17 Feb
                • Re: UPDATE routine giving exceptiongary clark18 Feb
                  • Re: UPDATE routine giving exceptionJames Vanns19 Feb
                    • Re: UPDATE routine giving exceptiongary clark19 Feb
                      • Re: UPDATE routine giving exceptiongary clark23 Feb
                        • Re: UPDATE routine giving exceptionWarren Young23 Feb
                          • Re: UPDATE routine giving exceptiongary clark23 Feb
                            • Re: UPDATE routine giving exceptionWarren Young24 Feb
                              • Re: UPDATE routine giving exceptionIan Miller24 Feb
                              • Re: UPDATE routine giving exceptiongary clark24 Feb
                                • Re: UPDATE routine giving exceptiongary clark28 Feb
                                  • Re: UPDATE routine giving exceptionWarren Young1 Mar
                                    • Re: UPDATE routine giving exceptiongary clark1 Mar
                                    • Re: UPDATE routine giving exceptiongary clark19 Mar
                                      • Re: UPDATE routine giving exceptionWarren Young19 Mar
                                        • Re: UPDATE routine giving exceptiongary clark19 Mar
                                          • Re: UPDATE routine giving exceptionWarren Young19 Mar
                                            • Re: UPDATE routine giving exceptiongary clark20 Mar
  • Re: Two bugs in 2.2.0Warren Young20 Feb
    • Re: Two bugs in 2.2.0Joseph Artsimovich20 Feb
      • Re: Two bugs in 2.2.0Jonathan Wakely20 Feb
        • Re: Two bugs in 2.2.0Joseph Artsimovich20 Feb
          • Re: Two bugs in 2.2.0Jonathan Wakely20 Feb
            • Re: Two bugs in 2.2.0Joseph Artsimovich20 Feb
              • Re: Two bugs in 2.2.0Jonathan Wakely20 Feb
        • Re: Two bugs in 2.2.0Warren Young20 Feb