title: How to check if template argument is std::variant?
body: <p>I want to write my own container <code>MyContainer</code>. Which implements an emplace method to construct objects in place.</p>
  
  <pre><code>template&lt;typename T&gt;
  MyContainer&lt;T&gt;::emplace(Args ... args)
  {
       // Some construction code ....
       *_cursor = T(args...);
       _cursor++;
       return *item;
  }
  </code></pre>
  
  <p>Though, I want to always return the <code>Allocator</code> type. Though this becomes a problem if the the template argument <code>T</code> is of type <code>std::variant</code>. I would like to do an SFINAE that chooses the overload that fits one with <code>std::variant</code>.</p>
  
  <pre><code>template&lt;typename T&gt;
  template&lt;typename Allocator, typename ... Args&gt;
  Allocator&amp;
  MyContainer&lt;T&gt;::emplace(Args ... args)
  {
       // Some construction code ....
       *_cursor = T(Allocator(args...)); // T is std::variant, Allocator is one variant of T.
       T* item = _cursor;
       _cursor++;
       return std::get&lt;Allocator&gt;(*item); // Here I want to return the correct variant
  }
  </code></pre>
  
  <p>(I know the compiler could choose the overload based on if I provide the <code>Allocator</code> template arg or not. But I would like to create my container to have an emplace method for sub types of a particular type as well not just std::variant/union types. So I'm not look for those sort of answers).</p>