]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/jump_mov.cpp
2 // Copyright Oliver Kowalke 2016.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
10 #include <boost/context/continuation.hpp>
12 namespace ctx
= boost::context
;
26 moveable( moveable
&& other
) {
27 std::swap( value
, other
.value
);
30 moveable
& operator=( moveable
&& other
) {
31 if ( this == & other
) return * this;
37 moveable( moveable
const& other
) = delete;
38 moveable
& operator=( moveable
const& other
) = delete;
44 c
= ctx::callcc( std::allocator_arg
, ctx::fixedsize_stack
{},
45 [&data
](ctx::continuation
&& c
){
46 std::cout
<< "entered first time: " << data
.value
<< std::endl
;
47 data
= std::move( moveable
{ 3 });
49 std::cout
<< "entered second time: " << data
.value
<< std::endl
;
50 data
= std::move( moveable
{});
53 std::cout
<< "returned first time: " << data
.value
<< std::endl
;
56 std::cout
<< "returned second time: " << data
.value
<< std::endl
;
57 std::cout
<< "main: done" << std::endl
;