remove need for temporary vector in cpp api