스마트1 [ C++ ] 스마트 포인터의 템플릿화 #ifndef __SMART_POINTER_TEMPLATE_H_ #define __SMART_POINTER_TEMPLATE_H_ #include #include using namespace std; template class Smart_Pointer { private: T * ptr; public: Smart_Pointer(T* _ptr); T& operator*() const; T operator->() const; ~Smart_Pointer(); }; template Smart_Pointer::Smart_Pointer(T* _ptr) : ptr(_ptr) { } template T& Smart_Pointer::operator*() const { return *ptr; } template T Smart.. 2019. 11. 30. 이전 1 다음