]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Use std::array for indexing structure
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 21 Jun 2019 12:27:28 +0000 (14:27 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 21 Jun 2019 12:27:28 +0000 (14:27 +0200)
base/nn.cc
incl/nn.h
incl/rrtbase.h

index d076d04a367af086ff1f9bbc522b1a7a44ed0cf1..3679210139a027b73c3cf9353766c6ee95a6487d 100644 (file)
@@ -118,7 +118,7 @@ RRTNode *nn3(
 }
 
 RRTNode *nn4(
-                std::vector<RRTNode *> (&nodes)[IYSIZE],
+                std::array<std::vector<RRTNode *>, IYSIZE> &nodes,
                 RRTNode *node,
                 float (*cost)(RRTNode *, RRTNode *))
 {
index 405cd8ca8633dc185d1fe8ca7cbf6b651dea6766..4870667c884abeb7b65618ac678b74ff7d7116ce 100644 (file)
--- a/incl/nn.h
+++ b/incl/nn.h
@@ -18,6 +18,7 @@ along with I am car. If not, see <http://www.gnu.org/licenses/>.
 #ifndef NEARESTNEIGHBOUR_H
 #define NEARESTNEIGHBOUR_H
 
+#include <array>
 #include "aux.h"
 #include "rrtbase.h"
 #include "rrtnode.h"
@@ -45,7 +46,7 @@ RRTNode *nn3(
                 RRTNode *node,
                 float (*cost)(RRTNode *, RRTNode *));
 RRTNode *nn4(
-                std::vector<RRTNode *> (&nodes)[IYSIZE],
+                std::array<std::vector<RRTNode *>, IYSIZE> &nodes,
                 RRTNode *node,
                 float (*cost)(RRTNode *, RRTNode *));
 RRTNode *nn5(
index 023a55053e6f20c4bb82887fde3ba9100098df77..7f0b06b0994f75f732e5aed13948c271684b3886 100644 (file)
@@ -18,6 +18,7 @@ along with I am car. If not, see <http://www.gnu.org/licenses/>.
 #ifndef RRTBASE_H
 #define RRTBASE_H
 
+#include <array>
 #include <chrono>
 #include <cmath>
 #include <pthread.h>
@@ -102,7 +103,7 @@ class RRTBase {
                 std::queue<RRTNode *> &firsts();
                 PolygonObstacle &frame();
                 std::vector<RRTNode *> &samples();
-                std::vector<RRTNode *> iy_[IYSIZE];
+                std::array<std::vector<RRTNode *>, IYSIZE> iy_;
                 Cell ixy_[IXSIZE][IYSIZE];
                 std::vector<CircleObstacle> *co();
                 std::vector<SegmentObstacle> *so();