createHostArray

createHostArray#

stdgpu: createHostArray
stdgpu Latest
Efficient STL-like Data Structures on the GPU

◆ createHostArray()

template<typename T >
T * createHostArray ( const stdgpu::index64_t  count,
const T  default_value = T() 
)

Creates a new host array and initializes (fills) it with the given default value.

Template Parameters
TThe type of the array
Parameters
[in]countThe number of elements of the new array
[in]default_valueA default value, that should be stored in every array entry
Returns
The allocated host array if count > 0, nullptr otherwise
Postcondition
get_dynamic_memory_type(result) == dynamic_memory_type::device if count > 0