Factor out shoving outputs into std::unique_ptr into macro