Use more references for vectors

This commit is contained in:
Jan Möbius
2023-08-23 09:09:44 +02:00
parent 6390bd2634
commit a18b0d8c5a
2 changed files with 8 additions and 8 deletions

View File

@@ -126,7 +126,7 @@ Gnuplot::Gnuplot(const string &style)
Gnuplot::Gnuplot(const string &title, Gnuplot::Gnuplot(const string &title,
const string &style, const string &style,
const string &labelx, const string &labely, const string &labelx, const string &labely,
vector<double> x, vector<double> y) const vector<double>& x, const vector<double>& y)
{ {
init(); init();
@@ -157,7 +157,7 @@ Gnuplot::Gnuplot(const string &title,
Gnuplot::Gnuplot(const string &title, const string &style, Gnuplot::Gnuplot(const string &title, const string &style,
const string &labelx, const string &labely, const string &labelx, const string &labely,
vector<double> x) const vector<double>& x)
{ {
init(); init();
@@ -349,7 +349,7 @@ void Gnuplot::plot_equation(const string &equation, const string &title)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void Gnuplot::plot_x(vector<double> d, const string &title) void Gnuplot::plot_x(const vector<double>& d, const string &title)
{ {
ofstream tmp; ofstream tmp;
ostringstream cmdstr; ostringstream cmdstr;
@@ -418,7 +418,7 @@ void Gnuplot::plot_x(vector<double> d, const string &title)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void Gnuplot::plot_xy(vector<double> x, vector<double> y, const string &title) void Gnuplot::plot_xy(const vector<double>& x, const vector<double>& y, const string &title)
{ {
ofstream tmp; ofstream tmp;
ostringstream cmdstr; ostringstream cmdstr;

View File

@@ -120,14 +120,14 @@ public:
const string & _style, const string & _style,
const string & _xlabel, const string & _xlabel,
const string & _ylabel, const string & _ylabel,
vector<double> _x, vector<double> _y); const vector<double>& _x, const vector<double>& _y);
/// Constructor calling plot_x(). /// Constructor calling plot_x().
Gnuplot(const string &_title, Gnuplot(const string &_title,
const string &_style, const string &_style,
const string &_xlabel, const string &_xlabel,
const string &_ylabel, const string &_ylabel,
vector<double> _x); const vector<double>& _x);
//@} //@}
~Gnuplot(); ~Gnuplot();
@@ -146,10 +146,10 @@ public:
//@{ //@{
/// Plot a single vector /// Plot a single vector
void plot_x(vector<double> _x, const string &_title); void plot_x(const vector<double>& _x, const string &_title);
/// Plot x,y pairs /// Plot x,y pairs
void plot_xy(vector<double> _x, vector<double> _y, const string &_title); void plot_xy(const vector<double>& _x, const vector<double>& _y, const string &_title);
/// Plot an equation of the form: y = ax + b /// Plot an equation of the form: y = ax + b
/// You supply a and b /// You supply a and b