/* Metrowerks Standard Library */ /* $Date: 2000/06/09 19:27:01 $ * $Revision: 1.8.8.3 $ * $NoKeywords: $ * * Portions Copyright © 1995-1999 Metrowerks, Inc. * All rights reserved. */ /** ** utility **/ #ifndef _UTILITY #define _UTILITY #include #include #ifndef RC_INVOKED #pragma options align=native #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) #pragma import on #endif #ifdef _MSL_FORCE_ENUMS_ALWAYS_INT #if _MSL_FORCE_ENUMS_ALWAYS_INT #pragma enumsalwaysint on #else #pragma enumsalwaysint off #endif #endif #ifdef _MSL_FORCE_ENABLE_BOOL_SUPPORT #if _MSL_FORCE_ENABLE_BOOL_SUPPORT #pragma bool on #else #pragma bool off #endif #endif #ifndef _MSL_NO_CPP_NAMESPACE namespace std { #endif // lib.operators, operators: #ifndef _MSL_NO_CPP_NAMESPACE namespace rel_ops { #endif template inline bool operator!=(const T& x, const T& y) { return static_cast(!(x == y)); } template inline bool operator> (const T& x, const T& y) { return static_cast(y < x); } template inline bool operator<=(const T& x, const T& y) { return static_cast(!(y < x)); } template inline bool operator>=(const T& x, const T& y) { return static_cast(!(x < y)); } #ifndef _MSL_NO_CPP_NAMESPACE } // std::rel_ops #endif // lib.pairs, pairs: template struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair(); pair(const T1& x, const T2& y); #ifndef _MSL_NO_MEMBER_TEMPLATE #ifndef _MSL_MUST_INLINE_MEMBER_TEMPLATE template pair(const pair& p); #else template inline pair(const pair& p) : first(p.first), second(p.second) { } #endif #endif }; template inline pair::pair() : first(T1()), second(T2()) { } template inline pair::pair(const T1& x, const T2& y) : first(x), second(y) { } #ifndef _MSL_NO_MEMBER_TEMPLATE #ifndef _MSL_MUST_INLINE_MEMBER_TEMPLATE template template inline pair::pair(const pair& p) : first(p.first), second(p.second) { } #endif #endif template inline bool operator==(const pair& x, const pair& y) { return static_cast(x.first == y.first && x.second == y.second); } template inline bool operator< (const pair& x, const pair& y) { return static_cast(x.first < y.first || (!(y.first < x.first) && x.second < y.second)); } template inline bool operator!=(const pair& x, const pair& y) { return static_cast(!(x == y)); } template inline bool operator> (const pair& x, const pair& y) { return y < x; } template inline bool operator>=(const pair& x, const pair& y) { return static_cast(!(x < y)); } template inline bool operator<=(const pair& x, const pair& y) { return static_cast(!(y < x)); } // make_pair is in flux right now. The standard version does not work with // built-in c-strings. There are two possible solutions in front of the C++ // committee. The std, but broken version is commented out, and the most // likely solution is commented in. // hh 000419 //template //inline //pair //make_pair(const T1& x, const T2& y) //{ // return pair(x, y); //} template inline pair make_pair(T1 x, T2 y) { return pair(x, y); } //template //inline //pair::value_type, Metrowerks::call_traits::value_type> //make_pair(const T1& x, const T2& y) //{ // using Metrowerks::call_traits; // typedef typename call_traits::value_type x_value_t; // typedef typename call_traits::value_type y_value_t; // return pair(static_cast(x), // static_cast(y)); //} #ifndef _MSL_NO_CPP_NAMESPACE } // namespace std #endif #ifdef _MSL_FORCE_ENUMS_ALWAYS_INT #pragma enumsalwaysint reset #endif #ifdef _MSL_FORCE_ENABLE_BOOL_SUPPORT #pragma bool reset #endif #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) #pragma import reset #endif #pragma options align=reset #endif // RC_INVOKED #endif // _UTILITY // hh 971220 fixed MOD_INCLUDE // hh 971226 Changed filename from utility.h to utility // hh 971226 Made include guards standard // hh 971226 added alignment wrapper // hh 971230 added RC_INVOKED wrapper // hh 980130 commented out // hh 990426 Rewrote. // hh 000130 Patched make_pair to work better with string literals