출처:공식 synta x문서 https://devdocs.io/cpp/container/listYou’rebrowsingtheC+documentation.Tobrowsealldocs, gotodevdocs.io(orpressesc) DevDocs Preferences Offline Data Changelog Guide About C++119 Algorithm 76 Atomic operations 31 Concepts 585 Containers Show more…(50)std;array;front std;array;max_size std;array;operator[]std;arr…devdocs.io정의 및 선언
std::list <type> id= {element1, element2, …};
목록 기본 함수 1. iterator (반복자) beginiterator 반환 end ( ) enditerator 반환 2. append & delete (추가 및 삭제) push_front ( ) 목록 앞에 추가 pop_front ( ) 목록 뒤에 추가 pop_back ( ) 목록 뒤에 삭제 insert (iterator, ) iterator 앞에 원소 추가 iterator를 가리키는 원소 삭제 3. 조회 (iterator) 원소의 수 반환 예
int main( ){//Create a list containing integersstd:: list <int>l={7,5,16,8};
// // Addan integer to the front of the listl.push_front (25); / Addan integer to the back of the listl.push_back (13);
// // Insert an integer before 16 by searching auto it = std : : find (l.begin ( ), l.end ( ), 16); if (it! = l.end ( ) {l.insert (it, 42); }
// // Iterate and print values of the list for (int n:l) {std:: cout <<n <<>
‘;}}