take smart ptr instead of ref. to avoid reference to rvalue