Boost logo

Boost Users :

Subject: [Boost-users] coroutine2: pull/push_type ctors with r-value ref arg
From: MM (finjulhich_at_[hidden])
Date: 2018-02-09 09:23:43


Hello,

push_type class have this ctor:

template< typename Fn >
    push_type( Fn && fn)

that moves the object fn, leaving it in a moved-from state.

I have a vector V1<C> of class C instances that expose a public member operator:

  void operator()( coroutine::pull_type& source );

and I would like to construct a vector V2 of push_types, of same size,
each element of V2 I construct by emplacing back a element from V1.

I assume that leaves the objects in vector V1 in a moved-from state
and not usable.
Those objects C in V1 are needed for other purposes.

Can I use those instances of C by accessing them where they've been
moved to inside the elements of V2?

If not, should I make a copy of V1 before populating V2?

Thanks,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net