I have a C++ piece of code
auto returnvalue = m_func(x, y, z);
where the type of m_func depends on a template parameter. Afterwards I deal with the returnvalue
which works fine until m_func
is a function returning void. But I need a mechanism which calls
m_func(x,y,z)
if the return value of m_func is void and the above version is not. Overall in pseudo code it need to look like
if ( returnvalue of m_func is void )
call m_func directly
else
auto retval = m_func(...)
handle the return value
How can these be done with C++11/14?
Edit:
m_func is either:
void func(type1 arg1, type2 arg, ...)
or
std::tuple<...> func(type1 arg1, type2 arg, ...)