On 5/12/20 12:20 PM, Иван Комиссаров wrote:
* Exceptions can be done where significant performance gains can be 
demonstrated and the API will by design not require a copy of the data (e.g. 
XML writer, stream writers, date time handling)
Let me disagree here. The decision should be taken on the fact if the object 
takes ownership of the string (and thus QString is used) or it only «looks» 
into it.

I agree. This however leaves us with questions regarding the API. E.g.:

class Attribute {
public:
  // OK: takes ownership
  void addAttribute(const QString &key, const QString &value);

  // does not take ownership
  bool hasAttribute(QStringView key) const;
};

Is it OK that you can call addAttribute("foo", "bar") but not hasAttribute("foo")? (And similar)

Thanks,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to