Wakan Tanka Wakan Tanka - 3 months ago 14
C++ Question

C++ weird syntax spotted in Aruco codes

I have found strange syntax in some of Aruco files:

vector< cv::Mat > thres_images(n_param1);


Seems like
thres_images
is function, but if yes then what is
vector< cv::Mat >
in front of it? It is not declaration nor definition. Later it is used as array:

thres = thres_images[n_param1 / 2];


PS: full code can be found here

Answer

thres_images is a vector and its ctor is passed n_param1 as initial container size. This ctor is referred to as a fill ctor.

Comments