Changeset 026cb10 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:22Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cf3b398
Parents:
26d2990
git-author:
Dzejrou <dzejrou@…> (2018-04-30 22:22:12)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:22)
Message:

cpp: added comparison operators for set and map

Location:
uspace/lib/cpp/include/impl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/impl/map.hpp

    r26d2990 r026cb10  
    525525                   const map<Key, Compare, Allocator>& rhs)
    526526    {
    527         // TODO: need lexicographical_compare
    528         return false;
     527        return lexicographical_compare(
     528            lhs.begin(), lhs.end(),
     529            rhs.begin(), rhs.end(),
     530            lhs.value_comp()
     531        );
    529532    }
    530533
     
    540543                   const map<Key, Compare, Allocator>& rhs)
    541544    {
    542         // TODO: need lexicographical_compare
    543         return false;
     545        return rhs < lhs;
    544546    }
    545547
     
    548550                    const map<Key, Compare, Allocator>& rhs)
    549551    {
    550         // TODO: need lexicographical_compare
    551         return false;
     552        return !(lhs < rhs);
    552553    }
    553554
     
    556557                    const map<Key, Compare, Allocator>& rhs)
    557558    {
    558         // TODO: need lexicographical_compare
    559         return false;
    560     }
     559        return !(rhs < lhs);
     560    }
     561
    561562    /**
    562563     * 23.4.5, class template multimap:
     
    10301031                   const multimap<Key, Compare, Allocator>& rhs)
    10311032    {
    1032         // TODO: need lexicographical_compare
    1033         return false;
     1033        return lexicographical_compare(
     1034            lhs.begin(), lhs.end(),
     1035            rhs.begin(), rhs.end(),
     1036            lhs.value_comp()
     1037        );
    10341038    }
    10351039
     
    10451049                   const multimap<Key, Compare, Allocator>& rhs)
    10461050    {
    1047         // TODO: need lexicographical_compare
    1048         return false;
     1051        return rhs < lhs;
    10491052    }
    10501053
     
    10531056                    const multimap<Key, Compare, Allocator>& rhs)
    10541057    {
    1055         // TODO: need lexicographical_compare
    1056         return false;
     1058        return !(lhs < rhs);
    10571059    }
    10581060
     
    10611063                    const multimap<Key, Compare, Allocator>& rhs)
    10621064    {
    1063         // TODO: need lexicographical_compare
    1064         return false;
     1065        return !(rhs < lhs);
    10651066    }
    10661067}
  • uspace/lib/cpp/include/impl/set.hpp

    r26d2990 r026cb10  
    473473                   const set<Key, Compare, Allocator>& rhs)
    474474    {
    475         // TODO: need lexicographical_compare
    476         return false;
     475        return lexicographical_compare(
     476            lhs.begin(), lhs.end(),
     477            rhs.begin(), rhs.end(),
     478            lhs.key_comp()
     479        );
    477480    }
    478481
     
    488491                   const set<Key, Compare, Allocator>& rhs)
    489492    {
    490         // TODO: need lexicographical_compare
    491         return false;
     493        return rhs < lhs;
    492494    }
    493495
     
    496498                    const set<Key, Compare, Allocator>& rhs)
    497499    {
    498         // TODO: need lexicographical_compare
    499         return false;
     500        return !(lhs < rhs);
    500501    }
    501502
     
    504505                    const set<Key, Compare, Allocator>& rhs)
    505506    {
    506         // TODO: need lexicographical_compare
    507         return false;
    508     }
     507        return !(rhs < lhs);
     508    }
     509
    509510    /**
    510511     * 23.4.7, class template multiset:
     
    942943                   const multiset<Key, Compare, Allocator>& rhs)
    943944    {
    944         // TODO: need lexicographical_compare
    945         return false;
     945        return lexicographical_compare(
     946            lhs.begin(), lhs.end(),
     947            rhs.begin(), rhs.end(),
     948            lhs.value_comp()
     949        );
    946950    }
    947951
     
    957961                   const multiset<Key, Compare, Allocator>& rhs)
    958962    {
    959         // TODO: need lexicographical_compare
    960         return false;
     963        return rhs < lhs;
    961964    }
    962965
     
    965968                    const multiset<Key, Compare, Allocator>& rhs)
    966969    {
    967         // TODO: need lexicographical_compare
    968         return false;
     970        return !(lhs < rhs);
    969971    }
    970972
     
    973975                    const multiset<Key, Compare, Allocator>& rhs)
    974976    {
    975         // TODO: need lexicographical_compare
    976         return false;
     977        return !(rhs < lhs);
    977978    }
    978979}
Note: See TracChangeset for help on using the changeset viewer.