D14956: avoid any heap allocation for default constructed Format() as used as "invalid"

Christoph Cullmann noreply at phabricator.kde.org
Mon Aug 20 21:33:06 BST 2018


cullmann added a comment.


  Just for the implementation: Is the static default than just a e.g. function static QExplicitlySharedDataPointer<FormatPrivate>(new FormatPrivate()) like:
  
  QExplicitlySharedDataPointer<FormatPrivate> &staticDefault()
  {
  
    static QExplicitlySharedDataPointer<FormatPrivate> default(new FormatPrivate());
    return default;
  
  }
  
  and the constructor will do
  
  Format::Format() : d(staticDefault())
  {
  }
  
  or is that some other trick?

REPOSITORY
  R216 Syntax Highlighting

REVISION DETAIL
  https://phabricator.kde.org/D14956

To: cullmann, vkrause
Cc: dhaumann, kwrite-devel, kde-frameworks-devel, michaelh, kevinapavew, ngraham, bruns, demsking, cullmann, sars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20180820/ffee6ac0/attachment.html>


More information about the KWrite-Devel mailing list