템플릿

    [c++] template <typename T>에 대해서

    1. 키워드c++, c, template, typename,T,템플릿, 2. 설명template parameter의 멤버를 사용하고 싶은 경우 typename을 써야한다. 그렇지 않으면 정적멤버로 오해한다.(http://prorepo.tistory.com/164) 이건 무슨 소리일까? 뭐, 됐고, 일단 코드로 놀아보자. 3.이정도가 되면 그냥 이런 문법은 써도 된다는거겠지. #include template class Test { public: T m_store; void setStore(T store) { m_store = store; } T getStore() { return m_store; } }; int main() { int a; int *pa; a = 5; pa = &a; Test pInt; T..

    [c++] 제너릭(템플릿)과 형 안전성 ( <, > func<int> 등) 소스

    1.키워드 : 제너릭,형, 템플릿,c++,c,java 2.http://blog.naver.com/seektruthyb?Redirect=Log&logNo=150114746546 3. 이건 template선언 후 포인터로 할당하여 사용한 것. #include #include template class Temp { private: T data; public: void setData(T data) { this->data = data; } T getData() { return this->data; } }; int main(int argc, char* argvp[]) { char *pChar; pChar = new char[10]; strncpy(pChar, "hello", 10); pChar[5] = '\0'; ..