
AMDG John Torjo wrote:
Steven Watanabe wrote:
namespaceboost_1_1logging_1_1formatter_1_1convert.html "explain that you can extend the following - since they're namespaces!!! so that you can "inject" your own write function in the convert_format::prepend/or whatever namespace, and then it'll be automatically used!" I'm almost certain that this is wrong. In order to be found by a template
It's not - see http://torjo.blogspot.com/2007/10/template-construct.html
Ok. I'll be more concrete: namespace X { int foo(int) { return(0); } template<class T> int bar(const T& t) { return(foo(t)); } } class C { }; namespace X { int foo(C) { return(0); } } int main() { X::bar(C()); } Como says:
como -a test.cpp Comeau C/C++ 4.3.9 (Apr 4 2007 16:51:45) for _MS_WINDOWS_x86_Beta Copyright 1988-2007 Comeau Computing. All rights reserved. MODE:strict warnings C++ noC++0x_extensions
"test.cpp", line 9: error: no instance of overloaded function "X::foo" matches the argument list argument types are: (const C) return(foo(t)); ^ detected during instantiation of "int X::bar(const T &) [with T=C]" at line 21 1 error detected in the compilation of "test.cpp". In Christ, Steven Watanabe