no matching function for call to ‘std::vector<double*, std::allocator<double*> >::push_back(double&)
<p>I am trying to push 3 values (posx, posy, posz here) as the 0th-2nd elements of the vector atomPosRow_ and 3 values (velx, vely, velz) as the 0th-2nd elements of atomVelRow_. Eventually, I will be updating the size and content of these vectors.</p>

<p>I know I can just pass them in my main function but I wanted to have the function that does this as a part of the"Particle" class. At this point I am getting the error:  no matching function for call to ‘std::vector >::push_back(double&amp;). I believe I am not giving the right arguments to getRow but not sure where the error is coming from.</p>

<p>I am really sorry if this is a very trivial question, I am very new to object oriented programming and have been looking into this for the last two days and still could not figure it out.</p>

<p>Thanks so much in advance. </p>

<p>myheader.h</p>

<pre><code>#include &lt;iostream&gt;     // std::cout
#include &lt;fstream&gt;      // std::if
#include &lt;vector&gt;
using namespace std;

   class Particle {
   private:
    vector&lt;double&gt; boxLower_;
    vector&lt;double&gt; boxUpper_;
    vector&lt; vector&lt;double&gt; &gt; atomPos_;
    vector&lt; vector&lt;double&gt; &gt; atomVel_;
    int atomNumber_;
    double radius_;
  public:
    Particle(int atomNumber, double radius, vector&lt;double&gt; boxLower, vector&lt;double&gt; boxUpper, vector&lt; vector&lt;double&gt; &gt; atomPos, vector&lt; vector&lt;double&gt; &gt; atomVel);
    ~Particle();
    int getRow(double posx, double posy, double posz, double velx, double vely, double velz, vector&lt;double*&gt; atomPosRow, vector&lt;double*&gt; atomVelRow);
};`
</code></pre>

<p>myfunction.cpp</p>

<pre><code>#include "myheader.h"
Particle::Particle(int atomNumber, double radius, vector&lt;double&gt; boxLower, vector&lt;double&gt; boxUpper, vector&lt; vector&lt;double&gt; &gt; atomPos, vector&lt; vector&lt;double&gt; &gt; atomVel)
  : atomNumber_(atomNumber),
    radius_(radius),
    boxLower_(boxLower),
    boxUpper_(boxUpper),
    atomPos_(atomPos),
    atomVel_(atomVel)
{}

Particle::~Particle()
{}

int Particle::getRow(double posx, double posy, double posz, double velx, double vely, double velz, vector&lt;double*&gt; atomPosRow, vector&lt;double*&gt; atomVelRow) {
  atomPosRow.push_back(posx); // Add an element (column) to the row
  atomPosRow.push_back(posy);
  atomPosRow.push_back(posz);
  atomVelRow.push_back(velx);
  atomVelRow.push_back(vely);
  atomVelRow.push_back(velz);
return 0;
}
</code></pre>

<p>main.cpp</p>

<pre><code>#include &lt;iostream&gt;   
#include &lt;fstream&gt;    
#include &lt;vector&gt;
#include "myheader.h"

using namespace std;

int main() {
double xlow, ylow, zlow, xup, yup, zup;

vector&lt;double&gt; boxLower_;
vector&lt;double&gt; boxUpper_;
vector&lt; vector&lt;double&gt; &gt; atomPos_;
vector&lt; vector&lt;double&gt; &gt; atomVel_;

ifstream inputFile("data.txt");
int atomNumber_;
double radius_;
inputFile &gt;&gt; atomNumber_ &gt;&gt; radius_;
inputFile &gt;&gt; xlow &gt;&gt; ylow &gt;&gt; zlow;
inputFile &gt;&gt; xup &gt;&gt; yup &gt;&gt; zup;

boxLower_.push_back(xlow);
boxLower_.push_back(ylow);
boxLower_.push_back(zlow);
boxUpper_.push_back(xup);
boxUpper_.push_back(yup);
boxUpper_.push_back(zup);

double posx = 0;
double posy = 0;
double posz = 0;
double velx = 0;
double vely = 0;
double velz = 0;

Particle *assignParticles;
assignParticles = new Particle(atomNumber_, radius_, boxLower_, boxUpper_, atomPos_, atomVel_);

while (inputFile &gt;&gt; posx &gt;&gt; posy &gt;&gt; posz &gt;&gt; velx &gt;&gt; vely &gt;&gt; velz)
{
  vector&lt;double*&gt; atomPosRow_;
  vector&lt;double*&gt; atomVelRow_;
  assignParticles-&gt;getRow(posx, posy, posz, velx, vely, velz, atomPosRow_, atomVelRow_);
  //atomPos_.push_back(atomPosRow_); // Add the row to the main vector
  //atomVel_.push_back(atomVelRow_);
}
inputFile.close();
return 0;
}
</code></pre>