C++ 제너릭 프로그래밍, 템플릿 프로그래밍, STL - vector


C++ 제너릭 프로그래밍, 템플릿 프로그래밍, STL - vector

제네릭 프로그래밍(generic programming) 제네릭 프로그래밍은 모든 상황에 대해서 일반적으로 적용할 수 있게 프로그래밍해서 재사용율을 높인 것이다. 서로 다른 데이터 타입을 하나의 배열로 처리하는 것을 예시로 들 수 있다. 템플릿을 사용하여 구현을 한다. 템플릿 프로그래밍(template programming) 템플릿 프로그래밍은 언어에서 제공하는 템플릿 위에 프로그래밍을 하는 것이다. 이를 메타 프로그래밍이라고도 한다. 정의는 아래와 같다. template<class T, T::type n = 0> class X; struct S { using type = int; }; 간단한 사용 예시이다. 참고 - https://www.geeksforgeeks.org/templates-cpp/ Templates in C++ - GeeksforGeeks A template is a simple and yet very powerful tool in C++. The simple idea...


#c #stl #vector #제너릭프로그래밍 #템플릿프로그래밍

원문링크 : C++ 제너릭 프로그래밍, 템플릿 프로그래밍, STL - vector