Why error: ambiguating new declaration of 'std::string& strs(std::string&, const char*)'
Dec 10, 2019 at 2:46am UTC
Got this
error: ambiguating new declaration of 'std::string& strs(std::string&, const char*)'
though the declaration is bit different in types prototype,
ie. only in returned value type
1 2 3 4 5 6 7 8
inline string strs(string& s, const char * key){
size_t f;
return (f=s.find(key))==string::npos? "" : s.substr(f);
}
inline string& strs(string& s, const char * key){
// ...
}
How to solve it?
Last edited on Dec 10, 2019 at 5:47am UTC
Dec 10, 2019 at 3:37am UTC
> ie. only in returned value type
the return type is not part of the signature
strs(s, "hello world" );
¿which version do you think it should be called?
Topic archived. No new replies allowed.