noncopyable

How to make a copyable boost::signal?

I get why boost::signal is noncopyable (it's because copying a signal doesn't have a clear meaning), but I need a version of it that does provide some sort of copy ctor (either a no-op or one that copies all connections). The reason I need this is because in my project many objects become noncopyable just by virtue of featuring signals,...

How to create a container of noncopyable elements

Is there a way use STL containters with non-copyable elements? something like this: class noncopyable { noncopyable(noncopyable&); const noncopyable& operator=(noncopyable&); public: noncopyable(){}; }; int main() { list<noncopyable> MyList; //error C2248: 'noncopyable::noncopyable' : cannot access private member decla...

Virtual destructor for boost:noncopyable classes?

I have a question about the following code: class MyClass : private boost::noncopyable { public: MyClass() {} virtual ~MyClass() {} } class OtherClass : private boost::noncopyable { private: MyClass* m_pMyClass; } My thoughts are that MyClass cannot be copied using construction or assignment. Using a virtual des...

Is it good practice to generally make heavyweight classes non-copyable?

I have a Shape class containing potentially many vertices, and I was contemplating making copy-constructor/copy-assignment private to prevent accidental needless copying of my heavyweight class (for example, passing by value instead of by reference). To make a copy of Shape, one would have to deliberately call a "clone" or "duplicate" m...

How to exclude portions of text when copying

Im trying to make some text non-copyable, my aim isn't to stop people from copying text from my website but more to make it easier to use. I have a list of files with file size's but I want to only copy the file names and not the file size. So far i'v tried a few different methods but non have worked, I have managed to get the text non-...

How to deal with noncopyable objects when inserting to containers in C++

I'm looking for the best-practice of dealing with non-copyable objects. I have a mutex class, that obviously should not be copyable. I added a private copy constructor to enforce that. That broke the code - some places simply needed to be fixed, but I have a generic problem where a class, using the mutex either as a data member, or by ...

What are use cases for booster::noncopyable?

First: is it boost::noncopyable or booster::noncopyable. I have seen both in different places. Why would one want to make a class noncopyable? Can you give some sample use cases? ...

SFML Input system problem

So I was porting my game engine from SDL to SFML, and now I have a problem with my input system. Input.h #ifndef BULLWHIP_INPUT_H #define BULLWHIP_INPUT_H #include class bc_Input { public: bool bm_KeyHit(sf::Key::Code key); bool bm_KeyDown(sf::Key::Code key); int bm_MouseX(); int bm_MouseY(); ...