'What does (1) mean when declaring a vector?

What does the ...(1) do?

std::vector<std::vector<cv::Point>> tight_contour(1);


Solution 1:[1]

tight_contour is a std::vector object containing elements of type std::vector<cv::Point>. The (1) is constructing tight_contour to hold 1 initial default-constructed element.

Solution 2:[2]

That (1) is simply saying that tight_contour should be initialized with one element in it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Remy Lebeau
Solution 2 fireshadow52