1 // set stl/clr header
2 #ifndef _CLI_SET_
3  #define _CLI_SET_
4 #include <cliext/xtree>
5
6 namespace cliext {
7     namespace impl {
8 //
9 // TEMPLATE CLASS set_traits
10 //
11 template<typename _Key_t,    // key type
12     bool _Mflag,            // true if multiple equivalent keys are permitted
13     bool _Is_ref_key>        // true if key field is allocated
14     ref class set_traits
15     {    // traits required to make tree behave like a set
16 public:
17     typedef set_traits<_Key_t, _Mflag, _Is_ref_key> _Mytype_t;
18
19     typedef _Key_t key_type;
20     typedef _Key_t value_type;
21     typedef _STLCLR BinaryDelegate<key_type, key_type, bool>
22         key_compare;
23     typedef key_compare value_compare;
24
25     typedef _Key_t generic_key;
26
27     set_traits()
28         :    comp(gcnew key_compare(&_Key_compare)),
29             _Multi(_Mflag)
30         {    // construct with default comparator
31         }
32
33     set_traits(key_compare^ _Pred)
34         :    comp(_Pred),
35             _Multi(_Mflag)
36         {    // construct with specified comparator
37         }
38
39     key_compare^ key_comp()
40         {    // return object for comparing keys
41         return (comp);
42         }
43
44     value_compare^ value_comp()
45         {    // return object for comparing keys
46         return (comp);
47         }
48
49     static key_type get_key(value_type% _Val)
50         {    // extract key from element value
51         return (_Val);
52         }
53
Lines 54 ... 1051 are skipped.
1052         }
1053
1054     multiset(_Myenum_it^ _Right)
1055         :    _Mybase_t()
1056         {    // construct multiset from enumeration, default comparator
1057         for each (value_type _Val in _Right)
1058             insert(_Val);
1059         }
1060
1061     multiset(_Myenum_it^ _Right,
1062         key_compare^ _Pred)
1063         :    _Mybase_t(_Pred)
1064         {    // construct multiset from enumeration, comparator
1065         for each (value_type _Val in _Right)
1066             insert(_Val);
1067         }
1068
1069     // mutators
1070     void swap(multiset% _Right)
1071         {    // exchange contents with _Right
1072         _Mybase_t::swap(_Right);
1073         }
1074
1075     // interfaces
1076 public:
1077     virtual System::Object^ Clone() override
1078         {    // clone the vector
1079         return (gcnew _Mytype_t(*this));
1080         }
1081     };
1082
1083 //
1084 // TEMPLATE FUNCTION swap
1085 //
1086 template<typename _Key_t> inline
1087     void swap(multiset<_Key_t>% _Left,
1088         multiset<_Key_t>% _Right)
1089     {    // swap two multisets
1090     _Left.swap(_Right);
1091     }
1092 }    // namespace cliext
1093
1094 #endif // _CLI_SET_
1095
1096 /*
1097  * Copyright (c) 2004-2007 by Dinkumware, Ltd.  ALL RIGHTS RESERVED.
1098  * Consult your license regarding permissions and restrictions.
1099 V5.03:0009 */
1100