6
क्या सी ++, वेक्टर :: स्वैप विधि का उपयोग करके सी ++ में दो अलग-अलग वैक्टर स्वैप करना सुरक्षित है?
मान लीजिए कि आपके पास निम्नलिखित कोड हैं: #include <iostream> #include <string> #include <vector> int main() { std::vector<std::string> First{"example", "second" , "C++" , "Hello world" }; std::vector<std::string> Second{"Hello"}; First.swap(Second); for(auto a : Second) std::cout << a << "\n"; return 0; } वेक्टर की कल्पना करो std::string, अभी तक कक्षाएं नहीं …