| 257 | |
| 258 | template <typename T> |
| 259 | cuda_data_ptr<T> static_pointer_cast(const cuda_data_void_ptr &ptr) |
| 260 | { |
| 261 | DLIB_CASSERT(ptr.size() % sizeof(T) == 0, |
| 262 | "Size of memory buffer in ptr doesn't match sizeof(T). " |
| 263 | << "\nptr.size(): "<< ptr.size() |
| 264 | << "\nsizeof(T): "<< sizeof(T)); |
| 265 | cuda_data_ptr<T> result; |
| 266 | result.pdata = ptr; |
| 267 | result.num = ptr.size() / sizeof(T); |
| 268 | return result; |
| 269 | } |
| 270 | |
| 271 | template <typename T> |
| 272 | cuda_data_ptr<T> static_pointer_cast(const cuda_data_void_ptr &ptr, size_t num) |