क्यों इस कोड कामरेंज के लिए लूप और std :: वेक्टर <bool>
std::vector<int> intVector(10);
for(auto& i : intVector)
std::cout << i;
और यह नहीं है करता है?
std::vector<bool> boolVector(10);
for(auto& i : boolVector)
std::cout << i;
उत्तरार्द्ध मामले में, मैं एक त्रुटि
error: invalid initialization of non-const reference of type ‘std::_Bit_reference&’ from an rvalue of type ‘std::_Bit_iterator::reference {aka std::_Bit_reference}’
for(auto& i : boolVector)
संभावित डुप्लिकेट [सी ++ 11 की श्रेणी-आधारित का उपयोग करने का सही तरीका क्या है?] (Http://stackoverflow.com/q/15927033/3425536) ("वेक्टर" के लिए खोजें) –
emlai