title: Compile time default values for static members of static struct defined inside classes
body: <p>I would like to have a design suggestion from you.</p>
  
  <p>I have a set of classes in C++, every class has a bunch of variables (<code>double</code> and <code>int</code>) which determines the behavior of the algorithms they implement.</p>
  
  <p>Something like this:</p>
  
  <pre><code>class Foo
  {
    private:
    double value1, value2, etc...;
    public: 
    void setOptions(double val1, double val2);
    /*
    and here other methods...
    */
  };
  
  class Bar
  {
    private:
    double value1, value2, etc...;
    public: 
    void setOptions(double val1, double val2);
    /*
    and here other methods...
    */
  };
  </code></pre>
  
  <p>I would like to group all these option variables in a single class, so that is possible to dynamically change the variables of the options in the instances of the classes, but I would also like to give the <code>value</code> variables a default value as initialization.</p>
  
  <p>I would like that the options variables are different and set with a default value at compile time for every class.</p>
  
  <p>I adopted the following approach:</p>
  
  <pre><code>// Options.h
  class Options
  {
      public:
      Options();
  
      static struct FooOptions
      {
        static double option1;
        static double option2;
      } fooOptions;
  
      static struct BarOptions
      {
        static double option1;
        static double option2;
          // etcetera
      } barOptions;  
  };
  </code></pre>
  
  <p>and then in the <code>Foo</code> and <code>Bar</code> classes I use the value <code>Options::FooOptions::option1</code> and so on.</p>
  
  <p>The problem here is that I can't initialize those value statically.
  I'm used to initialize static member outside in the .cpp file, but in my .cpp </p>
  
  <pre><code>// Options.cpp
  Options::FooOptions::option1 = 1.0;
  </code></pre>
  
  <p>I get the following compiler 
  <code>error: error: expected constructor, destructor, or type conversion before ‘=’ token</code></p>
  
  <p>On other hand if I initialize them inside the constructor:</p>
  
  <pre><code>// Options.cpp
  Options::Options()
  {
      FooOptions::option1=1.0;
  }
  </code></pre>
  
  <p>I get <code>undefined reference</code> error when I try to access it from my <code>main</code>.</p>
  
  <p>I think the problem here is that I have two nested static structures. What can be here an optimal solution for this kind of design?</p>
  
  <p>How would you implement a class that acts only as container of <code>double</code> and <code>int</code> values to use inside classes as parameters of algorithms?</p>