//========= Copyright, Valve Corporation, All rights reserved. ================// // // std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes // //=============================================================================// #ifndef UTLPAIR_H #define UTLPAIR_H #ifdef _WIN32 #pragma once #endif // std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes template class CUtlPair { public: CUtlPair() {} CUtlPair( T1 t1, T2 t2 ) : first( t1 ), second( t2 ) {} bool operator<( const CUtlPair &rhs ) const { if ( first != rhs.first ) return first < rhs.first; return second < rhs.second; } bool operator==( const CUtlPair &rhs ) const { return first == rhs.first && second == rhs.second; } T1 first; T2 second; }; // utility to make a CUtlPair without having to specify template parameters template inline CUtlPair MakeUtlPair( T1 t1, T2 t2 ) { return CUtlPair(t1, t2); } //// HashItem() overload that works automatically with our hash containers //template //inline uint32 HashItem( const CUtlPair &item ) //{ // return HashItem( (uint64)HashItem( item.first ) + ((uint64)HashItem( item.second ) << 32) ); //} #endif // UTLPAIR_H