Demo app shows std::stable_partition and std::rotate works

From the beginning of Sean Parent’s great C++ talk, he represented two std algorithms people may not be familiar of. It’s ‘std::stable_partition’ and ‘std::rotate’.

I made a small demo application shows how the two algorithms works. It’s Qt5 based application so that you can freely compile and run from Windows, mac or Linux. Grab the code here:

std::stable_partition example

std::rotate example



Resolving the LNK2019 error while linking QT app

If you’re developing a QT based application(which links QT libs as statically) and get LNK2019unresolved external symbol’ link errors when you try to link the other static library,
Then you probably start looking those link settings such as,
☐ whether the architecture for the binary is correct(Are you trying to link an x86 lib to the x64 binary?)
☐ the static library file name specified to Input property was correct(Configuration Properties > Linker > Input > Additional Dependencies)
☐ they both use the same platform toolset or CRT lib(MT or MD)
☐ ‘dumpbin /headers’ for looking into export symbols
☐ or looking for some name mangling exists which might have caused the issue
However, if you’re still getting the LNK2019 unresolved link errors and it started frustrating although tried every setting you could, then you really should check the following setting as well.
The QT project seems to have the ’Treat WChar_t As Built in Type’ setting as ‘Noby default(see the attachment screen capture). However, Visual C++ static library project uses the option as Yes unless you haven’t changed it intentionally. Well, for me, the link error was resolved when I changed the option to Yes from the main QT application project settings.
Set to ‘Yes’ for the QT application to link a static library. Of course, it will be different in case you use different ‘Treat WChar_t As Built in Type’ setting  for the static library.