cmoon::meta::type_list<Types...>::contains





template<typename T>
[[nodiscard]] static constexpr bool contains() noexcept;


(1)

Returns true if T is a type within this type_list, returns false otherwise.

Parameters

(none)

Return value

true if T is a type within this type_list, false otherwise.

Exceptions

This function never throws exceptions

Complexity

Constant.

Example



import cmoon.meta;

int main()
{
    using tl = cmoon::meta::type_list<int, float, char, int>;

    if constexpr (tl::contains<int>())
    {
        return tl::index<int>();
    }
    else
    {
        return -1;
    }
}