reference vector<X,A>::front();
#include <vector>
const_reference vector<X,A>::front() const;
#include <iostream>
#include <vector>
int main()
{
using namespace std;
// Create two vector instances
vector<int> qV1;
qV1.push_back(3);
qV1.push_back(4);
vector<int> qV2;
qV2.push_back(9);
qV2.push_back(7);
// Get references to the first entries
int& irIntRef = qV1.front();
const int& kirConstIntRef = qV2.front();
cout << "The first entry of V1 = " << irIntRef << endl;
cout << "The first entry of V2 = " << kirConstIntRef << endl;
// Keep the window open
cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.