Re: [sigc] Move constructor for slots not selected



Thank you Kjell, I have overlooked that slot<> itself is not movable. I don't need a branch for this, can 
live without movable slots for now.

On 10/23/2015 08:48 PM, Kjell Ahlstedt wrote:
There are move constructors and move assignment operators for sigc::slot_base and sigc::slot1<> .. 
sigc::slot7<>, but none for sigc::slot<>. See https://bugzilla.gnome.org/show_bug.cgi?id=756484. Adding 
them would mean adding API, which will have to wait until libsigc++ 2.7.x. Like I say in comment 4 in the 
bug report, I can create a libsigc-2-6 branch and push the patch to the master branch now, if you want it 
now, and is willing to use the latest code from the git repository.

Kjell

Den 2015-10-23 kl. 14:01, skrev Andrejs Hanins:
Hi,

     I noticed that both in 2.6.1 and current trunk (cabc88f) the move constructor for the slot is not 
selected by the compiler (gcc 4.9 and 4.8.4 tried) even in the most trivial case. Take test_slot_move.cc 
unit test for example:

sigc::slot<void,int> s2(std::move(s1));

If you now do (bool)s1 it will evaluate to 'true'. Also s1() works and calls foo() as if s1 wasn't moved 
to s2. I tried to add traces to slot1 copy and move constructors and indeed only copy constructor is 
called, but not move. So, something is wrong here - either compiler bug (unlikely) or some code in the 
slot/slot_base/functor_base prevents compiler from selecting move semantics for constructor.

BR, Andrey
_______________________________________________




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]