git-svn-id: svn://db.shs.com.ru/pip@522 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
10
main.cpp
10
main.cpp
@@ -3,17 +3,15 @@
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/*PIVector2D<PIVariant> v(2, 2, PIVector<PIVariant>() << PIVariant(1) << PIVariant(2) << PIVariant(3) << PIVariant(4));
|
||||
PIVector2D<double> v(2, 2, PIVector<double>() << 1 << 2 << 3 << 4);
|
||||
piCout << v;
|
||||
PIByteArray ba;
|
||||
ba << v;
|
||||
piCout << ba.size();
|
||||
PIVector2D<PIVariant> v2;
|
||||
PIVector2D<double> v2;
|
||||
ba >> v2;
|
||||
piCout << v2;*/
|
||||
double f = 10.0002;
|
||||
PIString s = PIString::fromNumber(f, 'g', 6);
|
||||
piCout << s;
|
||||
piCout << v2;
|
||||
piCout << v2[0][1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,13 @@
|
||||
|
||||
#include "pivector.h"
|
||||
|
||||
/*! \brief 2D array,
|
||||
* \details This class used to store 2D array of any type elements as plain vector.
|
||||
* You can read/write any element via operators [][], first dimension - row, second - column.
|
||||
* The first dimension is Row, and you can operate with Row as PIVector<T>: modify any element, assign to another Row and etc.
|
||||
* You can't add values to array, but you can modify any elements or create another PIVector2D.
|
||||
* PIVector2D has constructors from PIVector<T> and PIVector<PIVector<T> >
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
class PIVector2D {
|
||||
@@ -125,6 +132,8 @@ public:
|
||||
return ret;
|
||||
}
|
||||
PIVector<T> toPlainVector() const {return mat;}
|
||||
PIVector<T> & plainVector() {return mat;}
|
||||
const PIVector<T> & plainVector() 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!";
|
||||
|
||||
Reference in New Issue
Block a user