I have a simple snipped below:
template<typename>
struct function_traits;
template<typename Rv, typename... Args>
struct function_traits<Rv(Args...)>
{
static constexpr const char _signature[] = {GetTypeChar<Rv>, '(', GetTypeChar<Args>()..., ')', '\0'};
}
where GetTypeChar returns character representing a type (i for integer, d for double et cetra).
This works really well for simple types, eg function_traits<int(float,double)>::_signature returns i(f,d) as expected.
Now Imagine I would have the ability to see whether it is an array or not by adding '[]' after the array, eg double[] would result in d[].
I tried changing the signature to
static constexpr const char _signature[] = {GetTypeChar<Rv>(), '(', (std::is_array_v<Args> ? GetTypeChar<Args>(), '[', ']' : GetTypeChar<Args>())..., ')', '\0'};
but that seems to be completely ignored, and only things after : are evaluated.
Is something like this possible?