// // YaPB - Counter-Strike Bot based on PODBot by Markus Klinge. // Copyright © 2004-2020 YaPB Project . // // SPDX-License-Identifier: MIT // #pragma once #include #include CR_NAMESPACE_BEGIN // simple pair (twin) template class Twin final { public: A first; B second; public: template Twin (T &&a, U &&b) : first (cr::forward (a)), second (cr::forward (b)) { } template Twin (const Twin &rhs) : first (rhs.first), second (rhs.second) { } template Twin (Twin &&rhs) noexcept : first (cr::move (rhs.first)), second (cr::move (rhs.second)) { } public: explicit Twin () = default; ~Twin () = default; public: template Twin &operator = (const Twin &rhs) { first = rhs.first; second = rhs.second; return *this; } template Twin &operator = (Twin &&rhs) { first = cr::move (rhs.first); second = cr::move (rhs.second); return *this; } // specialized operators for binary heap, do not use as it's test only second element public: friend bool operator < (const Twin &a, const Twin &b) { return a.second < b.second; } friend bool operator > (const Twin &a, const Twin &b) { return b.second < a.second; } }; CR_NAMESPACE_END