PetrM

PetrM PetrM

Niner since 2011

Comments

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 1 of n

    Sorry for the poorly formatted previous post. Let me try it one more time. Consider this code:

     

    struct deleter {    void operator() (int* p) { delete p; }
    };
    
    std::unique_ptr<int> a(new int);
    std::unique_ptr<int> b;
    std::unique_ptr<int, deleter> c;
    b=a; // does not compile 
    c=a; // should not compile too; does not link

     

    I checked the stl source code that the operator = is private member but the "c=a" still compiles in VC2010. Am I missing something? Thanks for any insight. Petr