mirror of
https://github.com/boostorg/context.git
synced 2026-01-24 05:42:16 +00:00
add unit-test for passing pointers between execution_context
This commit is contained in:
@@ -41,6 +41,9 @@ struct Y {
|
||||
value1 = 3;
|
||||
}
|
||||
|
||||
Y( Y const&) = delete;
|
||||
Y & operator=( Y const&) = delete;
|
||||
|
||||
~Y() {
|
||||
value1 = 7;
|
||||
}
|
||||
@@ -183,6 +186,11 @@ ctx::execution_context< variant_t > fn14( ctx::execution_context< variant_t > ct
|
||||
return ctx;
|
||||
}
|
||||
|
||||
ctx::execution_context< Y * > fn15( ctx::execution_context< Y * > ctx, Y * py) {
|
||||
ctx( py);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
void test_move() {
|
||||
value1 = 0;
|
||||
@@ -343,6 +351,13 @@ void test_one_arg() {
|
||||
std::tie( ctx, k) = ctx( i);
|
||||
BOOST_CHECK( & i != & k);
|
||||
}
|
||||
{
|
||||
Y y;
|
||||
Y * py = nullptr;
|
||||
ctx::execution_context< Y * > ctx( fn15);
|
||||
std::tie( ctx, py) = ctx( & y);
|
||||
BOOST_CHECK( py == & y);
|
||||
}
|
||||
{
|
||||
moveable m1( 7), m2;
|
||||
BOOST_CHECK( 7 == m1.value);
|
||||
|
||||
Reference in New Issue
Block a user