Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #89476

Re: reference to reference (Type &&)

From Paavo Helde <eesnimi@osa.pri.ee>
Newsgroups comp.lang.c++
Subject Re: reference to reference (Type &&)
Date 2023-03-06 12:53 +0200
Organization A noiseless patient Spider
Message-ID <tu4gnp$1lr8a$1@dont-email.me> (permalink)
References <tu2f60$1cnvt$2@dont-email.me>

Show all headers | View raw


05.03.2023 18:14 MarioCPPP kirjutas:
> Could sb explain me what is the semantic meaning of that syntax  and 
> what possible use-cases does a Type && have ?
> 
> A reference is an "hidden" immutable pointer to an object (with some 
> syntactic sugar to access members by DOT and not by ->), which should 
> also a be warranty to point to a valid object (no nullptr).
> 
> But a Type && seems to be also able to point to ... to what ?
> What is for ?

It's used to avoid deep copying of objects, either for better 
performance or when a copy does not make sense, like a file stream. One 
could think of it as a cleaner replacement of swap.




Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

reference to reference (Type &&) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-05 17:14 +0100
  Re: reference to reference (Type &&) Öö Tiib <ootiib@hot.ee> - 2023-03-05 22:24 -0800
  Re: reference to reference (Type &&) Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-06 12:53 +0200
  Re: reference to reference (Type &&) James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-03-06 14:31 -0500
  Re: reference to reference (Type &&) Andrey Tarasevich <andreytarasevich@hotmail.com> - 2023-03-06 14:00 -0800
    Re: reference to reference (Type &&) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-06 23:22 +0100
      Re: reference to reference (Type &&) James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-03-06 19:48 -0500
        Re: reference to reference (Type &&) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-07 12:19 +0100
      Re: reference to reference (Type &&) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-07 03:48 -0800
        Re: reference to reference (Type &&) Öö Tiib <ootiib@hot.ee> - 2023-03-07 04:30 -0800
        Re: reference to reference (Type &&) Muttley@dastardlyhq.com - 2023-03-07 15:58 +0000
          Re: reference to reference (Type &&) Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-08 00:10 +0200
            Re: reference to reference (Type &&) Muttley@dastardlyhq.com - 2023-03-08 09:21 +0000
              Re: reference to reference (Type &&) Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-08 14:41 +0200
                Re: reference to reference (Type &&) Muttley@dastardlyhq.com - 2023-03-08 16:26 +0000
                Re: reference to reference (Type &&) "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-08 18:08 +0100
                Re: reference to reference (Type &&) Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-08 19:23 +0200
                Re: reference to reference (Type &&) Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-10 07:58 +0100
                Re: reference to reference (Type &&) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-09 02:19 +0100

csiph-web