mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
Provide a way to get around std::vector for a known type on device.
Use template specialisation to access a private member in the Clang++ STL implementation
This commit is contained in:
parent
7d6522c1ef
commit
d03ce5c2a4
@ -88,6 +88,15 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
lambda(it); \
|
lambda(it); \
|
||||||
}
|
}
|
||||||
#define cpu_loop( iterator, range, ... ) thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
#define cpu_loop( iterator, range, ... ) thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
||||||
|
|
||||||
|
#define NVCC_DECLARE_VECTOR_ACCESSOR(Type) \
|
||||||
|
template <> accelerator_inline typename Grid::Vector<Type>::reference Grid::Vector<Type>::operator[](Grid::Vector<Type>::size_type __n) { return this->__begin_[__n]; } \
|
||||||
|
template <> accelerator_inline typename Grid::Vector<Type>::const_reference Grid::Vector<Type>::operator[](Grid::Vector<Type>::size_type __n) const { return this->__begin_[__n]; }
|
||||||
|
|
||||||
|
#define NVCC_DECLARE_STD_VECTOR_ACCESSOR(Type) \
|
||||||
|
template <> accelerator_inline typename std::vector<Type>::reference std::vector<Type>::operator[](std::vector<Type>::size_type __n) { return this->__begin_[__n]; } \
|
||||||
|
template <> accelerator_inline typename std::vector<Type>::const_reference std::vector<Type>::operator[](std::vector<Type>::size_type __n) const { return this->__begin_[__n]; }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define accelerator
|
#define accelerator
|
||||||
#define accelerator_inline strong_inline
|
#define accelerator_inline strong_inline
|
||||||
@ -95,4 +104,10 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
||||||
#define cpu_loop( iterator, range, ... ) \
|
#define cpu_loop( iterator, range, ... ) \
|
||||||
thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
||||||
|
|
||||||
|
#define NVCC_DECLARE_STD_VECTOR_ACCESSOR(Type)
|
||||||
|
#define NVCC_DECLARE_VECTOR_ACCESSOR(Type)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NVCC_DECLARE_STD_VECTOR_ACCESSOR(int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user