본문 바로가기

Vectors in STL Vectors in STL It’s a dynamic array that the stardard does not specify. Header file : Declaretion: namespace std { template class vector; } Vector opertions Create, Copy, and Destory Operations Operation Effect vector c Creats an empty vector without any elements vector c1(c2) Create a copy of another vector of the same type (all elements are copied) vector c(n) Creates a vector with n elements .. 더보기
Singleton 출처 : http://ninvu.egloos.com/1469576 회사 모~대리가 쓴거...베낌.. ---------------------------------------------------------- 싱글톤 참 유용하게 쓰이는 클래스 입니다. 전역 변수를 두지 않고 어디서나 호출해서 쓸 수 있고 전역 변수와 달리 필요할 때 초기화 되는 잇점이 있죠. 뭐 잇점이야 말씀 안드려도 잘 아시겠지만 보통 이렇게 쓰죠? template class CSingleton { public: class CSingletonRelease { public: ~CSingletonRelease() { T::destory(); } }; static T* instance() { if (NULL == _inst) _inst = ne.. 더보기
[c/c++] 구조체 복제에 대한 이야기 가지고 있는 자료을 똑같은 복제본을 만들어야 될때는 매우 많다. 수십가지 데이터 혹은 수십개의 트리로 구성된 구조체를 일일히 하나씩 값을 넣는 다는 것은 곤혹스러운 일이 아닐 수 없다. 다음은 구조체에 대한 것으로 구조체를 복사하는 것에 대한 내용을 다루겠다. 작성자: ospace (ospace114 at empal.com) ospace.tistory.com/ 전형적인 구조체 복제 전형적인 구조체 복제 사용법은 다음과 같다. struct tag_Sport { TCHAR* pName; TCHAR pPlayer[10]; int score; }; int main() { tag_Sport soccer0 = {NULL, _T("Ospace"), 0}; tag_Sport soccer1; TCHAR name[] = .. 더보기

반응형