|
Boost Users : |
From: Michael Marcin (mmarcin_at_[hidden])
Date: 2006-11-22 15:17:55
Hello I'm working with a Codewarrior compiler (Nokia Codewarrior C/C++
Compiler for Windows/x86 version 3.2.3 build 451).
The following test code finds the proper overload for MSVC 2005 and doesn't
for the Codewarrior compiler but only with the = syntax. Does anyone have
any idea how to make "c" find its overload as well? It would make the
client code a lot cleaner to read/write.
#include <boost/type_traits/is_integral.hpp>
#include <boost/utility/enable_if.hpp>
struct tester
{
int value;
tester( float f )
: value((int)f)
{
}
tester( double d )
: value((int)d)
{
}
template< typename T >
tester( T val, typename boost::enable_if< boost::is_integral<T> >::type* =
0 )
: value(val)
{
zzz
}
};
void main()
{
tester a = 1.f; // works (chooses float overload)
tester b(1); // works (i.e. error on zzz)
tester c = 1; // works on vc2005 (i.e. error on zzz)
// fails on cw (ambiguous overload looking at float and double)
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net