उपयोग नहीं कर सकते निम्नलिखित कोड ठीक संकलित:समारोह नाम दूरी
#include <string>
int dist(std::string& a, std::string& b) {
return 0;
}
int main() {
std::string a, b;
dist(a, b);
return 0;
}
लेकिन जब मैं जिले से दूरी के समारोह का नाम बदलने:
#include <string>
int distance(std::string& a, std::string& b) {
return 0;
}
int main() {
std::string a, b;
distance(a, b);
return 0;
}
मैं इस त्रुटि मिलती है जब (जीसीसी 4.2 संकलन .1):
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h: In instantiation of ‘std::iterator_traits<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’:
b.cpp:9: instantiated from here
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:129: error: no type named ‘iterator_category’ in ‘struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >’
मैं फ़ंक्शन दूरी का नाम क्यों नहीं दे सकता?
मुझे पता था कि समस्या क्या थी। अगर मैं केवल 3 घंटे पहले यहां था। लॉल – 0x499602D2