title: Uninitialized constant members in classes
body: <p>This is probably a ridiculously easy question, but I've been searching around for the answer for a while yet can't seem to figure this out. I'm trying to initialize a constant variable constant pointer in a class. Here is the header file:</p>
  
  <pre><code>class Scheduler{
    public:
    Scheduler();
    explicit Scheduler( unsigned long * );
  
    private:
    const unsigned long *const thresh;
  
  };
  </code></pre>
  
  <p>And here is the constructor for the class</p>
  
  <pre><code>Scheduler::Scheduler( unsigned long * threshold ):
    thresh(threshold)
  {}
  </code></pre>
  
  <p>When I attempt to compile this code I run into this error:</p>
  
  <pre><code>scheduler.cpp: In constructor ‘Scheduler::Scheduler()’:
  scheduler.cpp:3: error: uninitialized member ‘Scheduler::thresh’ with ‘const’ type ‘const long unsigned int* const’
  </code></pre>
  
  <p>Multiple sources online discussing constant member variables in constructors for member variables point to using initializer lists. I think I'm doing what I'm supposed to, but apparently it's still no good. Can anyone see what's wrong?</p>