FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
March 01, 2004

Strict Ownership in STL Containers

(Page 5 of 6)
March 04:

Listing 4: Using RRef.

class Foo {
    public: 
        Foo() {}
        RRef<Bar> getBar() const {return _bar;}
        void reset() {_bar.reset();}
    private: 
        DynObj<Bar> _bar;
};
int main() {
    Foo foo; 
    RRef<const Bar> bar( foo.getBar() );
    bar().constMethod(); // ok
    foo.reset(); // destroys bar    
    bar().constMethod(); // assert fails
}




    
    
      
    
    
Previous Page | 1 | 2 | 3 | 4 | 5 | 6 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK