Understand C++ 'vector <string>pathList'

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,625
I need to understand the line that starts with 'vector' below to translate into different language. I don't understand the descriptions I have found online.
C:
struct point
{
double x,y;
};

struct path
{
point coord;
vector <string>pathList;
};
 

xox

Joined Sep 8, 2017
936
An std::vector is just a generic container that internally manages a C array. It provides functions to resize the container, query the current size, etc and is also designed in such a way that it works with the standard algorithms package. You can almost pretend it's an array though because it has functions that mimic their usage. Like pathList[0] gives you the first element and &pathList[0] gives you a pointer to the (current) first element.

What language are you trying to translate it to, by the way?
 
Last edited:

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,625
OK. So the <string> part means it's an 'array' of strings?
Further down the code there is '

vector <path>boardPaths;
Does the <path> here mean this is an array of the 'path' structure?

I may convert it to VB6 and then these sound like a VB6 container.
 
Top