there's a shortcut for this. you can just do bc::vector<bc::int_> vectorp(datap, datap + 2, queue) which both allocates the exact amount of space required and copies the data to the device.