diff --git a/config.htm b/config.htm index daadf429..5c7ec6bc 100644 --- a/config.htm +++ b/config.htm @@ -911,6 +911,62 @@ void g() { return f(); } x; if the compiler requires a return, even when it can never be reached. + + + + BOOST_EXPLICIT_TEMPLATE_TYPE(t)
+ BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
+ + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
+ + Some compilers silently "fold" different function template + instantiations if some of the template parameters don't appear + in the function parameter list. For instance: +
+  #include <iostream>
+  #include <ostream>
+  #include <typeinfo>
+
+  template <int n>
+  void f() { std::cout << n << ' '; }
+
+  template <typename T>
+  void g() { std::cout << typeid(T).name() << ' '; }
+
+  int main() {
+    f<1>();
+    f<2>();
+
+    g<int>();
+    g<double>();
+  }
+
+ incorrectly outputs "2 2 double double " on VC++ 6. + + These macros, to be used in the function parameter list, fix the + problem without effects on the calling syntax. For instance, in + the case above write: +
+  template <int n>
+  void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
+
+  template <typename T>
+  void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
+
+ + Beware that they can declare (for affected compilers) a dummy + defaulted parameter, so they +

a) should be always invoked *at the end* of the parameter list +
b) can't be used if your function template is multiply declared. +

+ + Furthermore, in order to add any needed comma separator, an "APPEND_*" + version must be used when the macro invocation appears after a normal + parameter declaration or after the invocation of another macro of this + same group. + + BOOST_USE_FACET(Type, loc) When the standard library does not have a comforming