#include <iostream>
struct Bystander
{
Bystander( )
{
std:: cout << "Innocent Bystander appears" << std:: endl ;
}
~Bystander( )
{
std:: cout << "Innocent Bystander was shot" << std:: endl ;
}
} ;
struct Accomplice
{
Bystander const & b;
Accomplice( Bystander const & b)
: b( b)
{
std:: cout << "Accomplice received Innocent Bystander" << std:: endl ;
}
~Accomplice( )
{
std:: cout << "Accomplice abandoned Innocent Bystander" << std:: endl ;
}
} ;
auto Perpetrator( Bystander const & b)
- > Accomplice
{
std:: cout << "Committing a Crime by giving Innocent Bystander to Accomplice" << std:: endl ;
return b;
}
int main( )
{
std:: cout << "About to interact with Perpetrator" << std:: endl ;
auto a = Perpetrator( Bystander( ) ) ;
std:: cout << "Finished interacting with Perpetrator" << std:: endl ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IEJ5c3RhbmRlcgp7CglCeXN0YW5kZXIoKQoJewoJCXN0ZDo6Y291dCA8PCAiSW5ub2NlbnQgQnlzdGFuZGVyIGFwcGVhcnMiIDw8IHN0ZDo6ZW5kbDsKCX0KCX5CeXN0YW5kZXIoKQoJewoJCXN0ZDo6Y291dCA8PCAiSW5ub2NlbnQgQnlzdGFuZGVyIHdhcyBzaG90IiA8PCBzdGQ6OmVuZGw7Cgl9Cn07CgpzdHJ1Y3QgQWNjb21wbGljZQp7CglCeXN0YW5kZXIgY29uc3QgJmI7CglBY2NvbXBsaWNlKEJ5c3RhbmRlciBjb25zdCAmYikKCTogYihiKQoJewoJCXN0ZDo6Y291dCA8PCAiQWNjb21wbGljZSByZWNlaXZlZCBJbm5vY2VudCBCeXN0YW5kZXIiIDw8IHN0ZDo6ZW5kbDsKCX0KCX5BY2NvbXBsaWNlKCkKCXsKCQlzdGQ6OmNvdXQgPDwgIkFjY29tcGxpY2UgYWJhbmRvbmVkIElubm9jZW50IEJ5c3RhbmRlciIgPDwgc3RkOjplbmRsOwoJfQp9OwoKYXV0byBQZXJwZXRyYXRvcihCeXN0YW5kZXIgY29uc3QgJmI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