Use std::ref instead of pointer