title: Sum the components of a tuple up by using std::get, std::tuple_size, std::tuple_element
body: <p>I've got a custom class that has a tuple-like interface. Because I want my code to be as generic as possible, I thought that it would be a good idea to base my algorithms on the functions <code>std::get</code>, <code>std::tuple_size</code>, <code>std::tuple_element</code> so you just have to specialize these functions to use my algorithms. Let's call the concept that requires these function specializations <code>Tuple</code>.</p>
  
  <p>Now I am trying to sum up the components of a <code>Tuple</code>. The function declaration should be something like this:</p>
  
  <pre><code>template &lt;class Tuple&gt;
  int sum_components(const Tuple&amp; t);
  </code></pre>
  
  <p>I guess that there is a lot of template programming involved but I just can't figure out how to do it.</p>
  
  <p>For the addition I would just use an overload of the global <code>+ operator</code>.</p>
  
  <p>I am using c++1z.</p>