git-svn-id: svn://db.shs.com.ru/pip@512 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -126,6 +126,12 @@ public:
|
||||
}
|
||||
PIVector<T> toPlainVector() const {return mat;}
|
||||
|
||||
inline PIVector2D<T> & _resizeRaw(size_t r, size_t c) {
|
||||
piCout << "Error, \"resizeRaw()\" only allowed for simple type declared with __PIVECTOR_SIMPLE_TYPE__ macro!";
|
||||
assert(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
inline void copyRow(size_t start, const T * data, size_t size) {
|
||||
for (size_t i = 0; i < size; i++)
|
||||
@@ -156,4 +162,23 @@ inline PICout operator <<(PICout s, const PIVector2D<T> & v) {
|
||||
return s;
|
||||
}
|
||||
|
||||
#define __PIVECTOR2D_SIMPLE_TYPE__(T) \
|
||||
template<> inline void PIVector2D<T>::copyRow(size_t start, const T * data, size_t size) {memcpy(mat.data(start), data, size * sizeof(T));} \
|
||||
template<> inline PIVector2D<T> & PIVector2D<T>::_resizeRaw(size_t r, size_t c) {rows_ = r; cols_ = c; mat._resizeRaw(r*c); return *this;}
|
||||
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(bool)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(char)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(uchar)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(short)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(ushort)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(int)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(uint)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(long)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(ulong)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(llong)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(ullong)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(float)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(double)
|
||||
__PIVECTOR2D_SIMPLE_TYPE__(ldouble)
|
||||
|
||||
#endif // PIVECTOR2D_H
|
||||
|
||||
Reference in New Issue
Block a user