title: variadic template arguments with default values
body: <p>I have a templated struct that has a method that (along with other parameters) accepts those templated parameters.</p>
  
  <pre><code>template&lt;class... Types&gt;
  struct Observer
  {
      void subscribe(const std::string&amp; id, Types... args)
      {
          // store id somehow
          data = std::make_tuple(args...);
      }
  
      std::tuple&lt;Types...&gt; data;
  };
  </code></pre>
  
  <p>I want to make all the templated arguments optional. So that it looks like this:</p>
  
  <pre><code>Observer&lt;float, int&gt; observer;
  observer.subscribe("id1", 3.14, 4);
  observer.subscribe("id2", 0.707); // this doesn't work!
  observer.subscribe("id3");        // this doesn't work!
  </code></pre>
  
  <p>As far as I know there is not straight forward way? But maybe someone know a workaround or a trick. </p>
  
  <p>Ideally, I'd like to provide my own defaults. Maybe like this:</p>
  
  <pre><code>enum class SomeEnum { Val1, Val2 };    
  
  Observer&lt;float, SomeEnum, 0.f, SomeEnum::Val1&gt; observer;
  observer.subscribe("id1", 3.14);
  </code></pre>
  
  <p>Here is <a href="https://godbolt.org/z/Zl2914" rel="nofollow noreferrer">LIVE EXAMPLE</a>.</p>