title: Where to define class constants in C++?
body: <p>In C++, to have a tidier code, I want to declare a set of values as constants in my header file, example :</p>
  
  <pre class="lang-cpp prettyprint-override"><code>constexpr float SIZE_SMALL = 1.5f; 
  constexpr float SIZE_MEDIUM = 2.5f; 
  constexpr std::string COLOR_RED = "RED"; 
  constexpr std::string MATERIAL_SILK = "SILK";
  ...etc
  
  </code></pre>
  
  <p>But this is getting too long and clumsy. Also, some constants can be grouped together because they describe different values of the same property e.g. <code>SIZE_SMALL</code> and <code>SIZE_MEDIUM</code>.</p>
  
  <p>What is the best way to write this in my header file? I thought about structs e.g. </p>
  
  <pre class="lang-cpp prettyprint-override"><code>struct SIZE
  {
  float SMALL; 
  float MEDIUM; 
  }
  </code></pre>
  
  <p>but then I have to declare and define a variable in my .cpp and that kinda beats the purpose of all this.  </p>