Kernel word recovery crack, Mobile themes website for samsung wave 525, Dekha ek khwab sony tv title song, Song zombies on your lawn, Bloody mary nerve endings mp3, Digittrade tv jukebox, Padosan songs mp3, Gold cup series 70 manual, Nieuwste versie van mozilla firefox en, Cant install spotify on mac, Web brute force password cracker, Belkin g peek driver windows 7

C++11 lambdas

July 1st, 2012 by Martijn Leave a reply »

A small extract from my ongoing project Jam Fabric. C++11’s lamba functions can make code very consise.

bool Workspace::isEquivalentTo(const Workspace *other, bool checkValues) const {
    QList<Unit*> myUnits = findChildren<Unit*>();
    QList<Unit*> otherUnits = other->findChildren<Unit*>();
 
    if (myUnits.size() != otherUnits.size())
        return false;
 
    std::sort(myUnits.begin(), myUnits.end(), [](Unit* a, Unit* b) {
        return a->name() < b->name();
    });
 
    std::sort(otherUnits.begin(), otherUnits.end(), [](Unit* a, Unit* b) {
        return a->name() < b->name();
    });
 
    if (!std::equal(myUnits.begin(), myUnits.end(), otherUnits.begin(), [checkValues](Unit* a, Unit
* b) {
        return a->isEquivalentTo(b, checkValues);
    }))
    {
        return false;
    }
 
    return true;
}
Advertisement

Leave a Reply

Authorized tags:
[b]bold[/b] [u]underline[/u] [i]italic[/i] [url=http://link.url]link[/url] more