[cpp] explicitly cast new args and Array.map return value