#10080 closed Feature Requests (invalid)
Make optional copy-ctor
Reported by: | Owned by: | olli | |
---|---|---|---|
Milestone: | To Be Determined | Component: | coroutine |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I know that coroutines are made movable only to prevent UB during a stack unwinding of RAII objects. But there could be only POD objects and copy-ctor should work perfectly fine ( my scenario is a binary tree iterator that has a coroutine ).
So I suggest to make an optional ( via template parameter? ) copy constructor.
Change History (2)
comment:1 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 8 years ago
I agree that API should encourage a right use and discourage a wrong one. But I believe most of boost::coroutine users understand it's basic principles and a potential problem that could arise if the optional copy-ctor is being used. So I suggest a little on-my-own-risk freedom.
Note:
See TracTickets
for help on using tickets.
making coroutine copy-able would require to copy the stack. this is dangerous even with POD. you get unexpected behaviour if you copy a stack which has references/pointers to objects on the stack.
If you copy the stack above, j of the new (copied-to) stack would contain the address of i of the original (copied-from) stack.