|
|
@@ -284,6 +284,36 @@ int main()
|
|
|
either taking a value or a reference parameter.
|
|
|
|
|
|
|
|
|
+<h3>[instantiate memfun ptr] Instantiation with member function pointer</h3>
|
|
|
+
|
|
|
+When directly instantiating a template with some member function
|
|
|
+pointer, which is itself dependent on some template parameter, the
|
|
|
+compiler cannot cope:
|
|
|
+<pre>
|
|
|
+template<class U> class C { };
|
|
|
+template<class T>
|
|
|
+class A
|
|
|
+{
|
|
|
+ static const int v = C<void (T::*)()>::value;
|
|
|
+};
|
|
|
+</pre>
|
|
|
+
|
|
|
+<strong>Workaround:</strong> Use an intermediate <code>typedef</code>:
|
|
|
+
|
|
|
+<pre>
|
|
|
+template<class U> class C { };
|
|
|
+template<class T>
|
|
|
+class A
|
|
|
+{
|
|
|
+ typedef void (T::*my_type)();
|
|
|
+ static const int v = C<my_type>::value;
|
|
|
+};
|
|
|
+</pre>
|
|
|
+
|
|
|
+(Extracted from e-mail exchange of David Abrahams, Fernando Cacciola,
|
|
|
+and Peter Dimov; not actually tested.)
|
|
|
+
|
|
|
+
|
|
|
<h2>Library</h2>
|
|
|
|
|
|
|