Hi there, for whatever reason the compiler cannot decide the right
call to "make". Please consider the following code:
using namespace std;
using namespace boost;
template< typename T >
void make( const T& t ) {}
template< typename T >
void make( const T& t, int i ) {}
template< typename T >
void make( const T& t, int i, int j ) {}
struct a {};
struct b {};
void foo( string& s, a ) {}
void foo( string& s, b ) {}
int _tmain(int argc, _TCHAR* argv[])
{
string str( "Hello" );
make( ( bind( static_cast( &foo ), _1, _2)(
ref( str ) , a() )) );
return 0;
}
I want to make a call to the first make taking just on parameter, the
bind object. But the compiler thinks something else:
test.cpp(29) : error C2780: 'void make(const T &,int,int)' : expects 3
arguments - 1 provided
test.cpp(16) : see declaration of 'make'
test.cpp(29) : error C2780: 'void make(const T &,int)' : expects 2
arguments - 1 provided
test.cpp(13) : see declaration of 'make'
test.cpp(29) : error C2784: 'void make(const T &)' : could not deduce
template argument for 'const T1 &' from
'boost::_bi::bind_t::result_type'
with
[
R=void,
F=void (__cdecl *)(std::string &,a),
L=boost::_bi::list2,boost::arg<2>>::B1,boost::_bi::list_av_2,boost::arg<2>>::B2>
]
test.cpp(10) : see declaration of 'make'
How can I make that clear to the compiler?
Thanks ahead,
Christian