title: decltype(auto) in C++11 - deducing return type
body: <p>auto deduction of return types is possible in C++14 but I am trying to write something similar in C++11 i.e. </p>
  
  <p>If I were to write in C++14, it would be</p>
  
  <pre><code>struct MyTypeA{
      std::vector&lt;int&gt; _d;
  };
  
  struct MyTypeB{
      int _id;
      std::string _name;
      MyTypeA _data;
  };
  
  decltype(auto) MakeObject(const MyTypeA&amp; obj) {
      return std::make_tuple(obj._vec);
  }
  
  decltype(auto) MakeObject(const MyTypeB&amp; obj) {
      return std::make_tuple(obj._id, obj._name, std::make_tuple(MakeObject(obj._data)));
  }
  </code></pre>
  
  <p>The above is C++14 and I can rewrite <code>MakeObject</code> something similar in C++11 as below,</p>
  
  <pre><code>auto MakeObject (const MyTypeA&amp; obj) -&gt; decltype( std::make_tuple(obj._d)){
      return std::make_tuple(obj._d);
  };
  
  auto MakeObject (const MyTypeB&amp; obj) -&gt; decltype( std::make_tuple(obj._id, obj._name, std::make_tuple(MakeObject(obj._data)))){
      return std::make_tuple(obj._id, obj._name, std::make_tuple(MakeObject(obj._data)));
  };
  </code></pre>
  
  <p>And as you can see I have a bunch of overloaded non-member functions. Though this works, it seems very verbose and redundant code. Is there a better way to do this in C++11?</p>