<p>Hi all,</p>
<p>Specifically, we have a C++ source file like this:</p>
<p> template <int n><br>
struct N {};</p>
<p> struct B {<br>
template <typename M><br>
using A = typename std::conditional<std::is_same<M, N<4>>::value,<br>
int*, void*>::type;<br>
};</p>
<p> template <typename T, T value><br>
struct F : B {};</p>
<p> template <><br>
struct F<decltype(&fopen), &fopen> : B {<br>
template <typename M><br>
using A = double*;<br>
};</p>
<p> template <><br>
struct F<decltype(&fclose), &fclose> : B {<br>
template <typename M><br>
using A = typename std::conditional<std::is_same<M, N<16>>::value,<br>
void*, char**>::type;<br>
};</p>
<p> // More specialization of 'F' follows.</p>
<p>It is easy to find the [ClassTemplateDecl](<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html)s">http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html)s</a> of `N` and `F`, and the [QualType](<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">http://clang.llvm.org/doxygen/classclang_1_1QualType.html</a>) and [FunctionDecl](<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html</a>) of the function pointers `&fopen`, `&fclose`, etc. But the problem is how to substitute these arguments into N, F and F::A without modifying the source code.</p>
<p>The question is:</p>
<p>* How do I evaluate `F<decltype(&fprintf), &fprintf>::A<N<4>>` and know that it is an `int*`?<br>
* How do I evaluate `F<decltype(&fopen), &fopen>::A<N<7>>` and know that it is a `double*`?<br>
* and so on...</p>
<p>Kind regards<br>
Stewart</p>