the problem is simple. The code
sheep[0] = ba;
should be
sheep[0] = std::move(ba);
Your first approach used the copy constructor to copy the unique_ptr this defeats the purpose unique_ptr. Also another issue is:
Baa operator = (Baa&& param)
should be
Baa& operator = (Baa&& param)
Falconapollo wrote:
The final goal is Interfacing C++ member functions with C libraries.
If you want your C++ code to call C libraries then you use extern "C" { ...// C code and/or declarations. } If you want C libraries to call your C++ code then you must provide a C interface to it.
I believe the delete method should take a iMoney not HMODULE (which is what the error says.) And since it takes an iMoney there is no reason for it to not be static.
um...you might misunderstood me,i meants it's inconvenicent to edit *.rc file directly, for instance, adding dialog, adding strings, adding icons... it's even more inconvenient to use function: UpdateResource...
That is possibly a terrible idea you have 9999 Rect's as you are hoping it's singular process and you can process them on the fly. If you need to come back to them you just wasted a whole pile of time which you will have to repeat. If there is that many entries you would use the bounding box method as discussed by Supercoder and it may be better to bubble sort them or separate them into their own list at the same time while doing the test. At least then for any further processing you don't have to do the long overlap test again. So I am not convinced at all you would process them as per above it really depends what happens next.
In vino veritas
In general it may indeed be better to create it on the stack. The reason you'd use new is when you want more control over it's lifetime. For example you can't use the stack if it need to stay "alive" after the function returns (more generally, when it goes out of scope).
Steve
WTL is a light weight template library for creating UI controls. Michael Dunn[^] has written some great articles about WTL. These couple of articles would be useful for you - WTL for MFC Programmers, Part IV - Dialogs and Controls[^] WTL for MFC Programmers, Part V - Advanced Dialog UI Classes[^]
«_Superman_» _I love work. It gives me something to do between weekends.
_Microsoft MVP (Visual C++) (October 2009 - September 2013)
Polymorphism in C
I don't think you can; the function accepts any combination of the single values [ RED | GREEN | BLUE ] which allows up to 8 colours (16 if you add the highlight flag). If you want full colour control then you should be looking to use a proper Windows application which lets you use the complete range of RGB values.
Use the best guess
If the memory is returned, then it's not leaking. If you had a leak, then then the memory usage would keep growing until your application crashes. If you want your application to use less memory, then you'll have to look at how you use your data and the lifetime in which you keep it.
If the leak is due to a bug in a third party library then there may be no workaround to your issue. The operating system already caches out memory to a page file on disk. If you're exceeding the 1 or 3gig limit set by the linker, then you're hitting the wall on addressable memory. You can't allocate more memory than you can address. With 32 bit pointers the theoretical limit is 2^32 bytes or 4gig. In practical terms it's less because some of the bits in the upper end of the pointer can have a special meaning. I've seen server side systems live with leaks like this, by periodically restarting. If you can prove that the third party library is leaking the memory with a simple test case, then I would raise this issue with your vendor.
Code beautifiers, merely tidy up your source code. I don't believe they can tell you which of your files may no longer be needed. Why not just move all the resources away, try to build the project, and you will get a list of missing files.
Use the best guess
You can try with GetLastError and see if you can get better description of the error . The number returned from the function you can check in msdn. Good luck :)
You need to look at the actual error code value when you get a FAIL result, in order to see why it has failed.
One of these days I'm going to think of a really clever signature.