| Summary: | Creating a constructor implementation should automatically add initializer list for const members | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | Rolf Eike Beer <kde> |
| Component: | Language Support: CPP (old) | Assignee: | kdevelop-bugs-null |
| Status: | CONFIRMED --- | ||
| Severity: | wishlist | CC: | aspotashev |
| Priority: | NOR | ||
| Version First Reported In: | 4.90.91 | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
It's C++ things, so put it under C++ |
Guess I have a class that looks like this: class Foo : public QObject { ... Foo(QObject *parent); FooPrivate * const d_ptr; const QString m_something; }; When I now create an implementation for the constructor using the code completion I will get something like this: Foo::Foo(QObject *parent) : QObject(parent) { } The initializer list should also contain d_ptr and m_something, as they can only be ever written to in this initilizer list. You will score extra karma points if the completion for pointers, at least for a <classname>Private pointer will not just be d_ptr(), but d_ptr(new type_of_pointer()). You will score incredible karma if you also fill in some useful values for all this initializers, i.e. matching constructor arguments. And if a <classname>Private object has a <classname> argument then just add a "this" at that position. Reproducible: Always