title: Declaring global const objects in a header file
body: <p>In Eric Niebler's range-v3 library, he provides a lot of headers that each have their own global function object. They are all declared in the same way. He provides a class template <a href="https://github.com/ericniebler/range-v3/blob/master/include/range/v3/utility/static_const.hpp" rel="noreferrer"><code>static_const</code></a>:</p>
  
  <pre><code>template&lt;typename T&gt;
  struct static_const
  {
      static constexpr T value {};
  };
  
  template&lt;typename T&gt;
  constexpr T static_const&lt;T&gt;::value;
  </code></pre>
  
  <p>And then every function object of type <code>F</code> is declared as:</p>
  
  <pre><code>namespace
  {
      constexpr auto&amp;&amp; f = static_const&lt;F&gt;::value;
  }
  </code></pre>
  
  <p>What are the advantages of introducing the object through the <code>static_const</code> template <em>and</em> in an unnamed namespace, as opposed to just writing:</p>
  
  <pre><code>static constexpr F f{};
  </code></pre>