'python binding for enable_if_t<is_same_v<U, void>>

I need to bind for a fun of set(), which is defined as below:

template<typename U=T> std::enable_if_t<!is_same_v<U, void>> set(U const& val)
{
   set_value(val);
}

template<bool _Cond, typename _Tp=void>
using enable_if_t = typename enable_if<_Cond, _Tp>::type;

I tried to bind for the return type (std::enable_if_t<>):

void bind_enable_if_t(py::module &m)
{
    py::class<std::enable_if_t<bool, OutputDataType> pyClass(m, "enable_if_t", py::module_local()); 
}

I got error messages:

In function 'void bind_enable_if_t(pybind11:module&)':
error: type/value mismatch at argument 1 in template parameter list for 'template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type'

note: expected a constant of type 'bool', got 'bool'

What is the meaning of "expected a constant of type 'bool', got 'bool''? What'll be the correct way to do the binding?

Thanks for any suggestions.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source