c++ / 5. template를 사용해서 array만들기. - 1탄
c++ / 5. template를 사용해서 array만들기. - 1탄
template는 학부때, 혹은 c++의 책에 맨 마지막에 자리하게 되어서 잘 보지 않는 부분입니다.
그래서 회사에서 template로 된 소스를 이용해서 구현하는데 애좀 먹었죠...
그래서 준비했습니다.
template와 친해지기 바래 - template로 array만들기편
우선, array라 함은 메모리 동적할당이 일어나야 하니깐 memset이나 malloc을 resize하는 함수들과 친해져야합니다.
모르는 것이 나왔으니~ 검색!
terminal에서 man으로 검색해보니 아래와 같이 나옵니다.
MEMSET(3) Linux Programmer's Manual MEMSET(3) NAME memset - fill memory with a constant byte SYNOPSIS #include <string.h> void *memset(void *s, int c, size_t n); DESCRIPTION The memset() function fills the first n bytes of the memory area pointed to by s with the constant byte c. RETURN VALUE The memset() function returns a pointer to the memory area s. CONFORMING TO SVr4, 4.3BSD, C89, C99, POSIX.1-2001. SEE ALSO bzero(3), swab(3), wmemset(3) COLOPHON This page is part of release 3.54 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. |
여기를 쭉 읽다가 노다지를 발견했습니다~!ㅎㅎ
http://www.kernel.org/doc/man-pages/
위 사이트에서
http://man7.org/linux/man-pages/dir_section_3.html
을 들어가보니 여러가지 함수가 나왔는데, 이 중 mem*인 함수들이 있습니다.
이제 이 함수들을 읽어서 익힌 다음에 이 것을 사용해서 array를 구성하도록 하겠습니다.
c++ / 5. template를 사용해서 array만들기. - 1탄 끝.
template, array, example, c++, 예제, 소스, 코드, , 연습문제,