Valid CPP Dumps shared by ExamDiscuss.com for Helping Passing CPP Exam! ExamDiscuss.com now offer the newest CPP exam dumps , the ExamDiscuss.com CPP exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com CPP dumps with Test Engine here:
Access CPP Dumps Premium Version (230 Q&As Dumps, 35%OFF Special Discount Code: freecram )
What happens when you attempt to compile and run the following code? #include <vector> #include <iostream> #include <algorithm> using namespace std; template<typename T>class B { T val; public: B(T v):val(v){} T getV() const {return val;} bool operator < (const B & v) const { return val<v.val;} }; template<class T>ostream & operator <<(ostream & out, const B<T> & v) { out<<v.getV(); return out;} template<class T>struct Out { ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out<<val<<" "; } }; bool Less(const B<float> &a, const B<float> &b) { return int(a.getV())<int(b.getV());} int main() { float t[]={2.28, 1.66, 1.32, 3.94, 3.64, 2.3, 2.98, 1.96, 2.62, 1.13}; vector<B<float> > v1; v1.assign(t, t+10); stable_sort(v1.begin(), v1.end(), Less); for_each(v1.begin(), v1.end(), Out<B<float> >(cout));cout<<endl; return 0; } Program outputs: