typedef X& deque<X, A>::reference;
#include <deque>
#include <iostream> #include <deque> int main() { using namespace std; // Create a deque and add an element to it deque<int> qDeque; qDeque.push_back(5); // Assign a reference and output the element deque<int>::iterator qIter = qDeque.begin(); deque<int>::reference qRef = *qIter; cout << "qRef refers to = " << qRef << endl; // Change the value through the reference qRef = 30; cout << "qRef refers to = " << qRef << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.