// Code derived from Stroustrup's PPP2 book// § 8.5.4 Pass-by-const-reference// -and beginning on p 277#include<iostream>#include<vector>usingnamespacestd;voidprint(constvector<double>&v)// pass-by-const-reference{cout<<"{ ";for(inti=0;i<(int)v.size();++i){cout<<v[i];if(i!=(int)v.size()-1)cout<<", ";//---// v[i] = 7; // error: v is a const (is not mutable)}cout<<" }\n";}voidf(intx){vector<double>vd1(10);// small vectorvector<double>vd2(10000);// large vectorvector<double>vd3(x);// vector of some unknown size// ... fill vd1, vd2, vd3 with values ...print(vd1);print(vd2);print(vd3);}//------------------------------------------------------------------------------// call-by-value: copyintmy_find(vector<string>vs,strings);// call-by-const-reference: no copy, read-only access (for both vs and s)intmy_find(constvector<string>&vs,conststring&s);//------------------------------------------------------------------------------intmain(){f(10);}