Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In c++11, we have a better api--emplace_back

std::vector<cv::Vec4i> lines;
lines.emplace_back(0, 0, 10, 10);

clang++ and g++ already support emplace_back(remember to add the flag c++11 or c+0x) I don't know about the situation of visual c++

Remember to include your header file

#include<vector>

#include <openCV2/core/core.hpp>

int main()
{
  std::vector<cv::Vec4i> lines;
  lines.emplace_back(0, 0, 10, 10);
}

if your compiler don't support emplace_back yet use push_back suggested by Guanta

Besides, please take a look at c++ primer 5 edition, ch1~ch16 This could help you write robust, efficient and elegant codes by c++

In c++11, we have a better api--emplace_back

std::vector<cv::Vec4i> lines;
lines.emplace_back(0, 0, 10, 10);

clang++ and g++ already support emplace_back(remember to add the flag c++11 or c+0x) c++0x) I don't know about the situation of visual c++

Remember to include your header file

#include<vector>

#include <openCV2/core/core.hpp>
<opencv2/core/core.hpp>

int main()
{
  std::vector<cv::Vec4i> lines;
  lines.emplace_back(0, 0, 10, 10);
}

if your compiler don't support emplace_back yet use push_back suggested by Guanta

Besides, please take a look at c++ primer 5 edition, ch1~ch16 edition(ch1~ch16) This could help you write robust, efficient and elegant codes by c++

In c++11, we have a better api--emplace_back

std::vector<cv::Vec4i> lines;
lines.emplace_back(0, 0, 10, 10);

clang++ and g++ already support emplace_back(remember to add the flag c++11 or c++0x) I don't know about the situation of visual c++

Remember to include your header filefile and make sure you link to the correct library

#include<vector>

#include <opencv2/core/core.hpp>

int main()
{
  std::vector<cv::Vec4i> lines;
  lines.emplace_back(0, 0, 10, 10);
}

if your compiler don't support emplace_back yet use push_back suggested by Guanta

Besides, please take a look at c++ primer 5 edition(ch1~ch16) This could help you write robust, efficient and elegant codes by c++