Hi, I'm not sure whether here is the right place for my question, I'm sorry if I'm wrong.
I have a class A, and one of its constructor use 'const Glib::ustring&' as parameter. So, I think any value of type 'char*', 'std::string', 'Glib::ustring' should be accepted by the constructor. And I have a function, one of its parameter is 'const A&'. Because I have the conversion constructor in A, so I think the function can accept the value of type 'char*', 'std::string', 'Glib::ustring' as parameter and automatically convert it to A. However, the function can only accept the value of type 'A' or 'Glib::ustring' as parameter, it cannot automatically do the conversion of 'char*' and 'std::string'. I got following error message: error: conversion from ‘const char [6]’ to non-scalar type ‘A’ requested error: conversion from ‘std::string’ to non-scalar type ‘A’ requested error: invalid initialization of reference of type ‘const A&’ from expression of type ‘const char*’ error: invalid initialization of reference of type ‘const A&’ from expression of type ‘std::string’ I extract the problem and posted the code here: http://pastebin.com/tMakRmSu It looks like that I have to explicit convert them to A, which is not the way I want to, I hope those conversion can be implicit. Could you help me figure out why my code is wrong? Why the automatically conversion doesn't work? How can I make those conversion implicit? Thanks. -- Regards Tao Wang
_______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
