Wednesday, 15 February 2012

c++ - Proper style when writing a class within a class using a class template -



c++ - Proper style when writing a class within a class using a class template -

my title little confusing, allow me explain. have written linked template class can take , type of info in c++ (i rewrote std::list singly linked list), i'm trying define subclass iterator within list template, understand how implement of part, question regards proper coding style. understand templates unable break class separate header , source file, ok defined class set few function templates in there, underneath wrote functions... cool, regards subclass iterator, should write code these functions, there not much should write within class? or should write outside of list class, in same file? if how do convention genlist::iterator::next() work? or else (genlist linked list class, , next() function writing iterator)? or should define iterator outside of genlist on same header file? if unclear please inquire clarification of part

style questions off-topic, coding style utilize you. if want define iterator type's fellow member functions outside class definition syntax :

template<typename t> genlist<t>::iterator genlist<t>::iterator::operator++(int) { iterator tmp(*this); // increment *this homecoming tmp; }

personally define little fellow member functions inline in class definition.

is there reason phone call iterator iterator rather conventional iterator?

c++ coding-style

No comments:

Post a Comment