Add hb_pair_t<> and hb_pair()

This commit is contained in:
Behdad Esfahbod 2018-12-26 22:21:58 -05:00
parent 8303a9b011
commit c68bca0f95
1 changed files with 17 additions and 0 deletions

View File

@ -36,6 +36,23 @@ typedef const struct _hb_void_t *hb_void_t;
#define HB_VOID ((const _hb_void_t *) nullptr)
/*
* Pair
*/
template <typename T1, typename T2>
struct hb_pair_t
{
hb_pair_t (const T1& a, const T2& b) : first (a), second (b) {}
hb_pair_t (const hb_pair_t<T1, T2>& o) : hb_pair_t (o.first, o.second) {}
T1 first;
T2 second;
};
template <typename T1, typename T2> static inline hb_pair_t<T1, T2>
hb_pair (T1 a, T2 b) { return hb_pair_t<T1, T2> (a, b); }
/*
* Bithacks.
*/