implicit char conversion in templates

Joined
Nov 11, 2010
Messages
1
Reaction score
0
This test code is having the problem that the implicit character conversion will not compile. Is there a way to make this work without bind ?


template <typename T>
void ClientWriter(T something)
{
cout << "client is writing " << something << endl;
}

template <typename T>
void DataWarehouse (void (*external_writer)(T), T something)
{
external_writer(something);
}

int main(int argc , char * argv[])
{
ClientWriter<string>("this"); // implicit conversion works here
DataWarehouse(ClientWriter<int>, 42);
DataWarehouse(ClientWriter<string>, "this char string"); // will not compile

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top