Deque
-
I am getting an error in the cout statement?? What should I do?? C:\My Documents\lakshmi\cplusplus\stldeque\test.cpp(28) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::deque,class std::allocator main() { string alpha[4] = {"nava", "dana", "lakshmi", "pavi"}; deque ids1; for (int i =0; i<4; i++) { ids1.push_back(alpha[i]); } typedef deque::iterator id_iter1; for (id_iter1 i1 = ids1.begin(); i1 != ids1.end(); i1++ ) cout << *i1 << "\n"; }
-
I am getting an error in the cout statement?? What should I do?? C:\My Documents\lakshmi\cplusplus\stldeque\test.cpp(28) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::deque,class std::allocator main() { string alpha[4] = {"nava", "dana", "lakshmi", "pavi"}; deque ids1; for (int i =0; i<4; i++) { ids1.push_back(alpha[i]); } typedef deque::iterator id_iter1; for (id_iter1 i1 = ids1.begin(); i1 != ids1.end(); i1++ ) cout << *i1 << "\n"; }
i changed the iterator initialzation, and changed the order of the include files, and the code worked... #include #include #include using namespace std; main() { string alpha[4] = {"nava", "dana", "lakshmi", "pavi"}; deque ids1; for (int i =0; i<4; i++) { ids1.push_back(alpha[i]); } deque::iterator id_iter1 = ids1.begin(); for (; id_iter1 != ids1.end(); id_iter1++ ) cout << *id_iter1 << "\n"; }