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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PPB1994
    New Member
    • May 2018
    • 1

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

    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
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    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:

    Code:
    double x = 123.45;
    vector<double> arr;
    
    arr.push_back(x);
    You might read up on how to use a vector.

    Comment

    Working...