Changeset 82d256e in mainline


Ignore:
Timestamp:
2018-07-05T21:41:21Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
016d86e
Parents:
875788a8
git-author:
Dzejrou <dzejrou@…> (2018-04-24 16:43:48)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:21)
Message:

cpp: added the rest of pair specialized algorithms

File:
1 edited

Legend:

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

    r875788a8 r82d256e  
    214214     */
    215215
    216     // TODO: implement
     216    template<class T1, class T2>
     217    constexpr bool operator==(const pair<T1, T2>& lhs,
     218                              const pair<T1, T2>& rhs)
     219    {
     220        return lhs.first == rhs.first && lhs.second == rhs.second;
     221    }
     222
     223    template<class T1, class T2>
     224    constexpr bool operator<(const pair<T1, T2>& lhs,
     225                             const pair<T1, T2>& rhs)
     226    {
     227        return lhs.first < rhs.first ||
     228            (!(rhs.first < lhs.first) && lhs.second < rhs.second);
     229    }
     230
     231    template<class T1, class T2>
     232    constexpr bool operator!=(const pair<T1, T2>& lhs,
     233                              const pair<T1, T2>& rhs)
     234    {
     235        return !(lhs == rhs);
     236    }
     237
     238    template<class T1, class T2>
     239    constexpr bool operator>(const pair<T1, T2>& lhs,
     240                             const pair<T1, T2>& rhs)
     241    {
     242        return rhs < lhs;
     243    }
     244
     245    template<class T1, class T2>
     246    constexpr bool operator>=(const pair<T1, T2>& lhs,
     247                              const pair<T1, T2>& rhs)
     248    {
     249        return !(lhs < rhs);
     250    }
     251
     252    template<class T1, class T2>
     253    constexpr bool operator<=(const pair<T1, T2>& lhs,
     254                              const pair<T1, T2>& rhs)
     255    {
     256        return !(rhs < lhs);
     257    }
     258
     259    template<class T1, class T2>
     260    constexpr void swap(pair<T1, T2>& lhs, pair<T1, T2>& rhs)
     261        noexcept(noexcept(lhs.swap(rhs)))
     262    {
     263        lhs.swap(rhs);
     264    }
    217265
    218266    template<class T1, class T2>
Note: See TracChangeset for help on using the changeset viewer.