rewrite vector::assign with checked_copy