E D R , A S I H C RSS

Full text search for "RCIPtr"

RCI Ptr


Search BackLinks only
Display context of search results
Case-sensitive searching
  • MoreEffectiveC++/Techniques2of3 . . . . 29 matches
         이제 컴퓨터 우회적으로 방향을 바꾸는 부분(level)을 추가하는 방법으로 컴퓨터 과학이 처한 커다란 문제를 해결해 보자. 새로 추가될 ContHolder는 참조 세기 기능을 구현하고 있으며, 대신 RCPtr 클래스 역시 RCIPtr 클래스로 한다.("I"는 indirection(우회)의 의미로 붙은거다.) 이런 디자인은 다음과 같은 모습을 보일 것이다.
         기본 개념은 StringValue에서 적용된 방식과 비슷하다. CountHolder는 RCWidget의 클라이언트로 부터 구현 상황을 숨겨 버릴 것이다. 사실 자세한 구현은 RCIPtr에 거의 다되어 있다. 그래서 이 클래스의 구현 상황을 보자.
         class RCIPtr {
          RCIPtr(T* realPtr = 0);
          RCIPtr(const RCIPtr& rhs);
          ~RCIPtr();
          RCIPtr& operator=(const RCIPtr& rhs);
         void RCIPtr<T>::init()
         RCIPtr<T>::RCIPtr(T* realPtr)
         RCIPtr<T>::RCIPtr(const RCIPtr& rhs)
         RCIPtr<T>::~RCIPtr()
         RCIPtr<T>& RCIPtr<T>::operator=(const RCIPtr& rhs)
         void RCIPtr<T>::makeCopy() // copy-on-write 상황의 구현
         const T* RCIPtr<T>::operator->() const // copy-on-write를 비감안할
         T* RCIPtr<T>::operator->() // copy-on-write 감안
         const T& RCIPtr<T>::operator*() const // copy-on-write를 비감안할
         T& RCIPtr<T>::operator*() // copy-on-write 감안
         RCPPtr을 RCPtr과 오직 두가지 점에서 다른다. '''첫번째'''는 RCIPtr이 중간 조정자인 CountHolder통해서 접근하는 것과 달리 RCPtr 객체는 값을 직접 가리킨다는 점이다. '''두번째'''로는 operator->와 operator*을 오버로드(overload)해서 copy-on-write에 자동적으로 대응할수 있게 하였다.
         그럼 RCIPtr에 비하여 RCWidget은 상당히 구현이 간단하다. 거의 모든 기능이 RCIPtr에서 구현되었고, RCWidget은 그것을 통해서 인자만 전달하면 되기 때문이다.(delegate) 만약 Widget이 다음과 같이 생겼다면
          RCIPtr<Widget> value;
Found 1 matching page out of 7540 total pages (5000 pages are searched)

You can also click here to search title.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
Processing time 0.2843 sec