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
}
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
}