1 // utility stl/clr header
2 #ifndef _CLI_UTILITY_
3  #define _CLI_UTILITY_
4
5 #include <cliext/xutility>
6
7 namespace cliext {
8 //
9 // TEMPLATE REF CLASS pair
10 //
11 template<typename _Value1_t,
12     typename _Value2_t>
13     ref class pair
14     {    // store a pair of values
15 public:
16     typedef pair<_Value1_t, _Value2_t> _Mytype_t;
17     typedef typename _Value1_t first_type;
18     typedef typename _Value2_t second_type;
19
20     // basics
21     pair()
22         {    // construct default
23         }
24
25     pair(pair% _Right)
26         :    first(_Right.first), second(_Right.second)
27         {    // construct by copying _Right
28         }
29
30     pair(pair^ _Right)
31         :    first(_Right->first), second(_Right->second)
32         {    // construct by copying _Right
33         }
34
35     pair% operator=(pair% _Right)
36         {    // assign
37         first = _Right.first;
38         second = _Right.second;
39         return (*this);
40         }
41
42     pair% operator=(pair^ _Right)
43         {    // assign
44         first = _Right->first;
45         second = _Right->second;
46         return (*this);
47         }
48
49     // constructors
50     pair(first_type _Val1)
51         :    first(_Val1)
52         {    // construct from first value only
53         }
Lines 54 ... 463 are skipped.
464     class _Ty2> inline
465     bool operator<(_STLCLR GenericPair<_Ty1, _Ty2>^ _Left,
466         _STLCLR GenericPair<_Ty1, _Ty2>^ _Right)
467     {    // test if _Left < _Right for GenericPairs
468     return (_Left->first < _Right->first ||
469         !(_Right->first < _Left->first) && _Left->second < _Right->second);
470     }
471
472 template<class _Ty1,
473     class _Ty2> inline
474     bool operator>(_STLCLR GenericPair<_Ty1, _Ty2>% _Left,
475         _STLCLR GenericPair<_Ty1, _Ty2>% _Right)
476     {    // test if _Left > _Right for GenericPairs
477     return (_Right < _Left);
478     }
479
480 template<class _Ty1,
481     class _Ty2> inline
482     bool operator<=(_STLCLR GenericPair<_Ty1, _Ty2>% _Left,
483         _STLCLR GenericPair<_Ty1, _Ty2>% _Right)
484     {    // test if _Left <= _Right for GenericPairs
485     return (!(_Right < _Left));
486     }
487
488 template<class _Ty1,
489     class _Ty2> inline
490     bool operator>=(_STLCLR GenericPair<_Ty1, _Ty2>% _Left,
491         _STLCLR GenericPair<_Ty1, _Ty2>% _Right)
492     {    // test if _Left >= _Right for GenericPairs
493     return (!(_Left < _Right));
494     }
495
496 template<class _Ty1,
497     class _Ty2> inline
498     _STLCLR GenericPair<_Ty1, _Ty2>
499         make_generic_pair(_Ty1 _Val1, _Ty2 _Val2)
500     {    // return GenericPair composed from arguments
501     return (_STLCLR GenericPair<_Ty1, _Ty2>(_Val1, _Val2));
502     }
503         }    // namespace StlClr
504     }    // namespace VisualC
505 }    // namespace Microsoft
506 #endif // _CLI_UTILITY_
507
508 /*
509  * Copyright (c) 2004-2007 by Dinkumware, Ltd.  ALL RIGHTS RESERVED.
510  * Consult your license regarding permissions and restrictions.
511 V5.03:0009 */
512