By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

How to convert from double to std::vector<double>

P: 1
I am using Opencv libraries with C++ where I have to convert a value from double to vector double.How to do that??

Since I am very new to this software environment, can anyone help me on this
May 23 '18 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
A vector<double> is a container of double. You already have a double so I assume you want to add it to the vector (vector is replacement for an array).

Something like this:

Expand|Select|Wrap|Line Numbers
  1. double x = 123.45;
  2. vector<double> arr;
  3.  
  4. arr.push_back(x);
  5.  
You might read up on how to use a vector.
May 23 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.