From d9272f68e44e094466731e57929959a46dbaa9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Thu, 22 Jun 2017 14:31:43 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@522 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- main.cpp | 10 ++++------ src_main/containers/pivector2d.h | 9 +++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index 1acc5118..da053bec 100644 --- a/main.cpp +++ b/main.cpp @@ -3,17 +3,15 @@ int main(int argc, char *argv[]) { - /*PIVector2D v(2, 2, PIVector() << PIVariant(1) << PIVariant(2) << PIVariant(3) << PIVariant(4)); + PIVector2D v(2, 2, PIVector() << 1 << 2 << 3 << 4); piCout << v; PIByteArray ba; ba << v; piCout << ba.size(); - PIVector2D v2; + PIVector2D 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; } diff --git a/src_main/containers/pivector2d.h b/src_main/containers/pivector2d.h index d4ed2e16..b8c6a582 100644 --- a/src_main/containers/pivector2d.h +++ b/src_main/containers/pivector2d.h @@ -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: 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 and PIVector > + */ template class PIVector2D { @@ -125,6 +132,8 @@ public: return ret; } PIVector toPlainVector() const {return mat;} + PIVector & plainVector() {return mat;} + const PIVector & plainVector() const {return mat;} inline PIVector2D & _resizeRaw(size_t r, size_t c) { piCout << "Error, \"resizeRaw()\" only allowed for simple type declared with __PIVECTOR_SIMPLE_TYPE__ macro!";