title: Static, nonmember or static nonmember function?
body: <p>Every time I have some functionality which is in the direction of "utility", I end up wondering which option is the best. For instance, printing message structs (own or external), some encoding/decoding code or simply a few useful conversion functions in the context I'm working.</p>
  
  <p>The options I think about are:</p>
  
  <p><strong>1) Static function in helper class/struct.</strong></p>
  
  <pre><code>struct helper
  {
      static bool doSomething(...);
  };
  </code></pre>
  
  <p><strong>2) Nonmember function.</strong></p>
  
  <pre><code>namespace helper
  {
      bool doSomething(...);
  }
  </code></pre>
  
  <p><strong>3) Static nonmember function.</strong></p>
  
  <pre><code>namespace helper
  {
      static bool doSomething(...);
  }
  </code></pre>
  
  <p>In some cases there might be necessary to initialize or keep state in the "utility", so then I go for option 1 to avoid "global" state. However, if there is no state that needs to be kept, should I then option 2 or 3? What's the practical difference between option 2 and 3?</p>
  
  <p>What is <strong>important to consider</strong> and is there a <strong>preferred way</strong> to approach this? Thanks!</p>