Fix deprecated-copy warnings

It's long been a guideline (and IIRC a Weff-c++ warning) that either all, or
none, of the copy methods should be defined, but this became a standard warning
in GCC9.  Presumably to account for a later language change though I'm not sure
which.

I don't remember why the ChanMapping copy constructor can't just be a simple
copy (it's just a map of POD), but figure it's safer to just copy what that
does.
This commit is contained in:
David Robillard
2019-12-09 22:59:40 +01:00
parent 39bdde4250
commit 8ec3e5fb54
8 changed files with 39 additions and 0 deletions

View File

@@ -144,6 +144,8 @@ public:
template <typename BS, typename B>
class iterator_base {
public:
iterator_base(const iterator_base& other)
: _set(other._set), _type(other._type), _index(other._index) {}
B& operator*() { return (B&)_set.get_available(_type, _index); }
B* operator->() { return &(B&)_set.get_available(_type, _index); }
iterator_base<BS,B>& operator++() { ++_index; return *this; } // yes, prefix only

View File

@@ -45,6 +45,8 @@ public:
ChanMapping(const ChanMapping&);
ChanMapping(const XMLNode& node);
ChanMapping operator=(const ChanMapping&);
uint32_t get(DataType t, uint32_t from, bool* valid) const;
/** reverse lookup

View File

@@ -42,6 +42,8 @@ class /*LIBARDOUR_API*/ ComparableSharedPtr : public boost::shared_ptr<T>
ComparableSharedPtr (ComparableSharedPtr const & r) : boost::shared_ptr<T> (r) {}
ComparableSharedPtr& operator=(const ComparableSharedPtr& r) { *this = r; return *this; }
template<class Y>
ComparableSharedPtr(ComparableSharedPtr<Y> const & r) : boost::shared_ptr<T> (r) {}

View File

@@ -67,6 +67,22 @@ ChanMapping::ChanMapping (const XMLNode& node)
}
}
ChanMapping ChanMapping::operator=(const ChanMapping& other)
{
_mappings.clear();
const ChanMapping::Mappings& mp (other.mappings());
for (Mappings::const_iterator tm = mp.begin(); tm != mp.end(); ++tm) {
for (TypeMapping::const_iterator i = tm->second.begin(); i != tm->second.end(); ++i) {
set (tm->first, i->first, i->second);
}
}
_mappings = other._mappings;
return *this;
}
uint32_t
ChanMapping::get(DataType t, uint32_t from, bool* valid) const
{

View File

@@ -52,6 +52,11 @@ public:
, _program(std::max(0, std::min(program_num, 127)))
{}
inline PatchPrimaryKey(const PatchPrimaryKey& id)
: _bank(id._bank)
, _program(id._program)
{}
inline PatchPrimaryKey& operator=(const PatchPrimaryKey& id) {
_bank = id._bank;
_program = id._program;

View File

@@ -253,6 +253,11 @@ public:
return this->_current;
}
Property<T>& operator=(Property<T> const& v) {
this->set (v);
return *this;
}
private:
friend class PropertyFactory;

View File

@@ -53,6 +53,12 @@ struct JumpDistance {
JumpDistance () : value (1.0), unit (BEATS) {}
JumpDistance (double v, JumpUnit u) : value (v), unit (u) {}
JumpDistance (const JumpDistance& o) : value (o.value), unit (o.unit) {}
JumpDistance& operator= (const JumpDistance& o) {
value = o.value;
unit = o.unit;
return *this;
}
double value;
JumpUnit unit;
};

View File

@@ -37,6 +37,7 @@ public:
LIBTEMPORAL_API static const int32_t PPQN = 1920;
Beats() : _beats(0), _ticks(0) {}
Beats(const Beats& other) : _beats(other._beats), _ticks(other._ticks) {}
/** Normalize so ticks is within PPQN. */
void normalize() {