title: What's the difference between "static property" and static, const value?
body: <p>I'm trying to create static, constant member for a class. For now, I have this function based on C# way:</p>
  <pre><code>class Question : public QObject
  {
      Q_OBJECT
      friend class Answer;
  public:
      static const QMap&lt;QString /*name*/, QPair&lt;QList&lt;quint8&gt; /*data*/, qint32 /*answerSize*/&gt;&gt; questionMap()
      {
          return {
              {
                  &quot;check digit&quot;,
                  {
                      {
                          0xF0, 0xC0, 0x4F
                      },
                      3
                  }
              },
              {
                  &quot;line detect&quot;,
                  {
                      {
                          0xF0, 0xE0, 0x2F
                      },
                      79
                  }
              }
          };
      }
      static const Question&amp; createQuestion(const QString&amp; questionName) {
          Question* question = new Question(questionName,
                                            Question::questionMap()[questionName].first,
                                            Question::questionMap()[questionName].second);
          return *question;
      }
  </code></pre>
  <p>I wish to have something more like this:</p>
  <pre><code>static const QMap&lt;QString /*name*/, QPair&lt;QList&lt;quint8&gt; /*data*/, qint32 /*answerSize*/&gt;&gt; questionMap =
      {
          {
              &quot;check digit&quot;,
              {
                  {
                      0xF0, 0xC0, 0x4F
                  },
                  3
              }
          },
          {
              &quot;line detect&quot;,
              {
                  {
                      0xF0, 0xE0, 0x2F
                  },
                  79
              }
          }
      };
  </code></pre>
  <p>as I'm not sure how the first approach looks in terms of memory management... is this function called only once and there is no difference between two ideas or the object returned from the first function is created over and over again and it's more efficient to use the second approach? Anyway, when I'm trying to use value, it goes:</p>
  <blockquote>
  <p>field initializer is not constant</p>
  <p>in-class initialization of static data member of non-literal type</p>
  <p>non-constant in-class initiualization invalid for static member</p>
  <p>(an out of class initialization is required)</p>
  <p>cannot be initialized by a non-constant expression when being decalred</p>
  </blockquote>
  <p>And, of course, it works when I move the initializer out of class but... why exactly? And is there a way to go around it? Should I go around it? What's the most proper way of having this value handy?</p>