This question इस कोड स्निपेट है:'ए (टीएमपीवीक्टर) कैसे है;' 'ए टीएमपीवीक्टर' के समान ही?
A::A(const char *pc) {
A(string(pc));
}
A::A(string s) {
vector<string> tmpVector;
tmpVector.push_back(s);
A(tmpVector); // <-- error
}
// Constructor
A::A(vector<string> filePathVector) {
}
समस्या यह है कि vector<string> tmpVector;
साथ A(tmpVector);
संघर्ष:
error: conflicting declaration 'A tmpVector'
error: 'tmpVector' has a previous declaration as 'std::vector<std::basic_string<char> > tmpVector'
The answer का कहना है:
यह
ए (tmpVector);
इस
एक tmpVector जैसा ही है; // लेकिन वहाँ पहले से ही एक वस्तु tmpVector
कहा जाता है एक अतिरिक्त टिप्पणी के साथ है:
इस संदर्भ में,() ज़रूरत से ज़्यादा हैं।
मेरा प्रश्न है: ब्रांडेस अनिवार्य क्यों हैं? सी ++ 11 spec में वास्तव में क्या ऐसा करता है? मैंने पहले यह नहीं देखा है।
यह सी ++ 11 http: // ideone से संबंधित नहीं है।कॉम/एमएफजीकेएसक्यू – Geoffroy
निकटता से संबंधित http://stackoverflow.com/questions/24116817/when-do-extra-parentheses-have-an-effect-other-than-on-operator-precedence – 101010
हाँ मूल रूप से एक और डुप्ली "क्या है एमवीपी "? –