Avoid capturing strong shared_ptr in lambda