I use template but I get error I dont know why. there is no PyInt_FromInt function.
template <typename T>
void PyGiveArguments(PyObject* Obj,T arg)
{
Obj = PyTuple_New(PyTuple_GET_SIZE(Obj)+1);
if (std::is_same<T, std::string>::value)
{
PyTuple_SET_ITEM(Obj, PyTuple_GET_SIZE(Obj) + 1, PyString_FromString(arg.c_str()));
return;
}
else if (std::is_same<T, int>::value)
{
PyTuple_SET_ITEM(Obj, PyTuple_GET_SIZE(Obj) + 1, PyLong_FromSize_t(arg));
return;
}
}
it says (else if T,int block ) "argument cannot be converted from 'T' to 'size_t'";
I tried type convert but didnt help. I use pointer also didnt help