我有以下代码:
inline bool match(const std::wstring & text1, const std::wstring & text2)
{
return match(text1.c_str(), text2.c_str());
}
inline bool match(const std::wstring & text1, const wchar_t * text2)
{
return match(text1.c_str(), text2);
}
inline bool match(const wchar_t * text1, const std::wstring & text2)
{
return match(text1, text2.c_str());
}
inline bool match(const wchar_t * text1, const wchar_t * text2)
{
return !wcscmp(text1, text2);
}
我得到:
error C2666: 'match' : 3 overloads have similar conversions
1> could be 'bool match(const wchar_t *,const std::wstring &)'
1> or 'bool match(const std::wstring &,const wchar_t *)'
1> or 'bool match(const std::wstring &,const std::wstring &)'
wstring 和 wchar_t * 之间不应该有任何隐式转换(应该吗?),那么为什么会有这些歧义呢?
先感谢您