title: Type holder in std C++
body: <p>Is there in std C++ library anything like this?:</p>
  <pre><code>template &lt;typename T&gt;
  struct TypeHolder { using type = T; };
  </code></pre>
  <p>i.e. special structure that is only used to pass a type around and store it. The idea is that I want to pass it inside functions by value, like:</p>
  <p><a href="https://godbolt.org/z/aPoWWbT54" rel="nofollow noreferrer">Try it online!</a></p>
  <pre><code>void f(auto th) { typename decltype(th)::type val{}; }
  void h() {
      auto g = [](auto th){ typename decltype(th)::type val{}; };
      f(TypeHolder&lt;int&gt;());
      g(TypeHolder&lt;int&gt;());
  }
  </code></pre>
  <p>Of cause I can pass a type as <code>template &lt;typename T&gt;</code> but right now I want to pass it by value as one of auto-function's and/or non-templated lambda's params.</p>
  <p>There exists <a href="https://en.cppreference.com/w/cpp/types/integral_constant" rel="nofollow noreferrer">std::integral_constant</a> that can be somewhat usable for type holding, but it is not suitable for me because I don't want to provide value and/or instantiate value of my type. More than that I have non-structural types hence I can't provide its value inside std::integral_constant.</p>
  <p>Sure I can use templated structure <code>TypeHolder</code> mentioned above in code, but I'm looking for std-library based solution if it exists, not to reinvent wheel.</p>