c++ - Input values into custom class with "<<" -


i new c++, , trying figure out how following:

i have class holds qlist. trying populate qlist demonstrated below. wondering how achieve this? done in numberlist constructor? populate mylist using method takes list of objects, , extracts them fill qlist, not work example below.

numberlist mylist; mylist << 1 << 2 << 3; 

easy.

numberlist & operator<<(numberlist & lhs, number_t rhs) {     lhs.append(rhs);     return lhs; } 

or, member function, this:

numberlist & numberlist::operator<<(number_t rhs) {     append(rhs);     return *this; } 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -