Beispiel:
auto CClass::HasMultipleItems() -> bool {
return m_veciMember.size() > 1;
}
Archive for the ‘C++’ Category
C++ trailing return type
Montag, März 31st, 2025C++ Lambda Captures
Freitag, März 7th, 2025The difference is how the values are captured
Example:
int x = 1;
auto valueLambda = [=]() { cout << x << endl; };
auto refLambda = [&]() { cout << x << endl; };
x = 13;
valueLambda();
refLambda();
This code will print:
1
13
https://stackoverflow.com/questions/21105169/is-there-any-difference-betwen-and-in-lambda-functions
https://en.cppreference.com/w/cpp/language/lambda
Ubuntu: Qt QML QtQuick installieren
Donnerstag, Januar 16th, 2025sudo apt install qtcreator qtbase5-dev qt5-qmake cmake qtdeclarative5-dev qml-module-qtquick-controls
Qt: Inhalt einer QMap ausgeben
Donnerstag, Mai 2nd, 2024Beispiel:
for(auto key : themap.keys())
{
qDebug() << key << ":" << themap.value(key);
}
The Fear Of Adding Classes
Mittwoch, Juli 1st, 2020GUID erzeugen (MinGW)
Donnerstag, Mai 9th, 2019
#define APPGUID "XXXXXXXX-49DC-452D-BD0A-4318719DE9B9"
// mit uuidgen erzeugt
static bool TestAppRunning()
{
bool r = false;
#ifdef _WIN32
CreateMutexA(NULL, TRUE, APPGUID)
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
r = true;
}
#endif
return r;
}