Skip to content

Commit 4591e97

Browse files
committed
Add arrayCopy for std::vector and raw arrays
1 parent d0ab625 commit 4591e97

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,6 +2907,18 @@ template<class T> inline void arrayCopy(const T* src, T* dst, int length) {
29072907
::std::copy(src, src+length, dst);
29082908
}
29092909

2910+
// arrayCopy for std::vector
2911+
template<class T> inline void arrayCopy(const ::std::vector<T>& src, ::std::vector<T>& dst) {
2912+
dst = src;
2913+
}
2914+
template<class T> inline void arrayCopy(const ::std::vector<T>& src, int srcPos, ::std::vector<T>& dst, int dstPos, int length) {
2915+
for (int i=0;i<length;i++) dst[dstPos+i]=src[srcPos+i];
2916+
}
2917+
// arrayCopy for raw arrays
2918+
template<class T> inline void arrayCopy(const T* src, T* dst, int length) {
2919+
::std::copy(src, src+length, dst);
2920+
}
2921+
29102922

29112923
template<typename T>
29122924
Array<T> concat(const Array<T>& a, const Array<T>& b) {

0 commit comments

Comments
 (0)