Commit a5316401 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

timeseries [WP]: avoid copy constructor with base class argument

Taking a reference to a public base class object in a copy constructor allows
implicit type conversion even if the constructor is declared explicit. This
causes undesired type conversion in instatiation of timeseries containers. In
such cases the header data commonly is lost silently. I get rid of all such
constructors, forcing users to explicitly express the desire of type
parent 1e77702a
......@@ -130,9 +130,13 @@ namespace ts {
//! default constructor
SFFTimeSeries(): Tbase(), Mtraceindex(-1) { }
explicit SFFTimeSeries(const Tseries& s):
Tbase(s), Mtraceindex(-1) { }
SFFTimeSeries(const int& i=-1): Tbase(), Mtraceindex(-1) { }
SFFTimeSeries(const Tseries& s, const Theader& h, const int& i=-1):
Tbase(s, h), Mtraceindex(i) { }
SFFTimeSeries(const Tbase& s, const int& i=-1):
Tbase(s), Mtraceindex(i) { }
SFFTimeSeries(const SFFTimeSeries& s):
Tbase(s), Mtraceindex(s.Mtraceindex) { }
/*! \name Type conversion and assignment operators.
......@@ -105,10 +105,10 @@ namespace ts {
TimeSeries() { }
explicit TimeSeries(const Tseries& s): Tseries(s) { }
explicit TimeSeries(const Theader& h): header(h) { }
TimeSeries(const Tseries& s, const Theader& h):
Tseries(s), header(h) { }
TimeSeries(const Ttimeseries& s):
Tseries(s), header(s.header) { }
/*! \name Assignment operators.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment