Tuesday, March 5, 2019

Digest for comp.lang.c++@googlegroups.com - 25 updates in 2 topics

Manfred <invalid@add.invalid>: Mar 04 07:48PM -0500

> Clearly my question was too sophisticated, I'll rephrase: Does using && instead
> of & change the object code generated by the compiler if no other part of the
> code is changed?
 
 
==============================================
#include <iostream>
#include <ostream>
 
class Moveable
{
public:
Moveable(int val_)
: val(val_)
{
std::cout << "Moveable(int)" << std::endl;
}
 
Moveable(const Moveable& rhs)
: val(rhs.val)
{
std::cout << "Moveable(const Moveable&)" << std::endl;
}
 
#ifdef ENABLE_MOVE
Moveable(Moveable&& rhs)
: val(rhs.val)
{
rhs.val = 0;
std::cout << "Moveable(Moveable&&)" << std::endl;
}

No comments: