[Cs3] CS3

Mikhail Nesterenko mikhail at cs.kent.edu
Thu Mar 3 17:38:48 EST 2022


> I was wondering what the difference between the two versions of this code
> is, in which one uses char&& moved and the other uses char moved, if any.
> They both seem to compile when inserted into a program.
> 
> char ch = 'c';
> char moved = std::move(ch);
> std::cout << moved;
> //////////////////////////////////////
> char ch = 'c';
> char&& moved = std::move(ch);
> std::cout << moved;

char&& is an rvalue reference. Here is a detailed discussion in
overflow:

  https://stackoverflow.com/questions/5481539/what-does-t-double-ampersand-mean-in-c11

Thanks,
-- 
Mikhail


More information about the cs3 mailing list