Fix 'get() != pointer()' assertion copying ByteVectorList/StringList (#1211)

This reverts dfef09f13 but keeps the assignments as a comment so these
functions do not look like they can be defaulted even though they cannot.
This commit is contained in:
Urs Fleisch 2024-01-27 10:56:31 +01:00
parent 0ebb14b855
commit c8c4e5faec
2 changed files with 8 additions and 4 deletions

View File

@ -70,7 +70,8 @@ ByteVectorList::~ByteVectorList() = default;
ByteVectorList::ByteVectorList(const ByteVectorList &l) :
List<ByteVector>(l)
{
*d = *l.d;
// Uncomment if d is used, d.get() is nullptr and *d behavior undefined
// *d = *l.d;
}
ByteVectorList::ByteVectorList(std::initializer_list<ByteVector> init) :
@ -84,7 +85,8 @@ ByteVectorList &ByteVectorList::operator=(const ByteVectorList &l)
return *this;
List<ByteVector>::operator=(l);
*d = *l.d;
// Uncomment if d is used, d.get() is nullptr and *d behavior undefined
// *d = *l.d;
return *this;
}

View File

@ -59,7 +59,8 @@ StringList::StringList() = default;
StringList::StringList(const StringList &l) :
List<String>(l)
{
*d = *l.d;
// Uncomment if d is used, d.get() is nullptr and *d behavior undefined
// *d = *l.d;
}
StringList::StringList(std::initializer_list<String> init) :
@ -73,7 +74,8 @@ StringList &StringList::operator=(const StringList &l)
return *this;
List<String>::operator=(l);
*d = *l.d;
// Uncomment if d is used, d.get() is nullptr and *d behavior undefined
// *d = *l.d;
return *this;
}