How do I check if an std::variant can hold a certain type : <p>I have a class with an <code>std::variant</code> in it. This <code>std::variant</code> type is only allowed to hold a specific list of types.</p>

<p>I have template functions which allow the user of the class to insert various values into an <code>std::unordered_map</code>, the map holds values of this variant type. I.e., the user is only allowed to insert values if it's type is in the specific list of types. However, I don't want the user to be able to define this list of types themselves.</p>

<pre><code>class GLCapabilities
{
public:
    using VariantType = std::variant&lt;GLint64&gt;;  // in future this would have other types

    template &lt;typename T&gt;
    std::enable_if_t&lt;???&gt; AddCapability(const GLenum parameterName)
    {
        if(m_capabilities.count(parameterName) == 0)
        {
            /*... get correct value of type T ... */
            m_capabilities.insert(parameterName,value);
        }
    }

    template&lt;typename T&gt;
    std::enable_if_t&lt;???,T&gt; GetCapability(const GLenum parameterName) const
    {
        auto itr = m_capabilities.find(parameterName);
        if(std::holds_alternative&lt;T&gt;(*itr))
            return std::get&lt;T&gt;(*itr);

        return T;
    }

private:
    std::unordered_map&lt;GLenum,VariantType&gt; m_capabilities;
};
</code></pre>

<p>You'll see in the above where there's the <code>???</code>, how can I check? Some combination of <code>std::disjunction</code> with <code>std::is_same</code>?</p>

<p>Like</p>

<pre><code>std::enable_if&lt;std::disjunction&lt;std::is_same&lt;T,/*Variant Types???*/&gt;...&gt;&gt;
</code></pre>

<p>To make it clear, I'd prefer to not have to check against each allowed type manually.</p>
