RE: [Boost-users] Re: Question
Thanks for help,
I have an additional question. Does anyone know why the following program gives different output on VC++ 6 and VC++ 2003 NET? It is
This returns in both cases the same value. Is there a way around this problem at all? Thanks Pshemek -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Eric Niebler Sent: 12 May 2005 18:13 To: boost-users@lists.boost.org Subject: [Boost-users] Re: Question Sliwa, Przemyslaw (London) wrote: pretty
strange, isn't it?
<snip> VC6 is pretty strange, I agree. In particular, it doesn't handle functions with non-type template parameters well. The following code should demonstrate the problem. (Hopefully I'm remembering the problem correctly -- I don't have VC6 installed on this machine.) template<int I> void foo() { std::cout << I << '\n'; } int main() { foo<1>(); foo<2>(); return 0; } If you must use VC6, avoid non-type template parameters for function templates. -- Eric Niebler Boost Consulting www.boost-consulting.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users -------------------------------------------------------- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ --------------------------------------------------------
Please don't top post ... reordered.
VC6 is pretty strange, I agree. In particular, it doesn't handle functions with non-type template parameters well. The following code should demonstrate the problem. (Hopefully I'm remembering the problem correctly -- I don't have VC6 installed on this machine.)
template<int I> void foo() { std::cout << I << '\n'; }
int main() { foo<1>(); foo<2>(); return 0; }
If you must use VC6, avoid non-type template parameters for function templates.
Sliwa, Przemyslaw (London) wrote:
This returns in both cases the same value. Is there a way around this problem at all?
Thanks
Pshemek
Try using integer wrappers. The MPL ones should do the trick:
template<typename Int> void foo()
{ std::cout << Int::value << '\n'; }
int main() {
foo
Sliwa, Przemyslaw (London) wrote:
This returns in both cases the same value. Is there a way around this problem at all?
See http://womble.decadentplace.org.uk/c++/template-faq.html#vc6-name-mangling-b.... Ben.
participants (3)
-
Ben Hutchings
-
Eric Niebler
-
Sliwa, Przemyslaw (London)