Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


Stl map of China

[code]
14.00 KEY{
           .....
Bool operator ====== (const KEY& i) (
Bool ret;
                    . ..
Return ret;
           }
Bool operator "; (CONST KEY& i) (
Bool ret;
                    . ..
Return ret;
           }
Bool operator "(CONST KEY& i) (
Bool ret;
                    . ..
Return ret;
           }
            ....
      }

14.00 VALUE{
           ....
     }

Map<KEY, VALUE>; my_map;
KEY one_key;
//assign Value to one_key
//insert Something here


Map<KEY, VALUE>; : : iterator mit = my_map.find (one_key);


[/code]


Compiler incorrect report

But map<KEY removed, VALUE>; : : iterator mit = my_map.find (one_key); After not being given a. Help us to see what we

Stl map of China

Bool operator< (const KEY& i) const

Insert CONST.


[code]template "Typename _Key, typename _Tp, typename _Compare = less<_Key>;.
Typename _Alloc = allocator<pair<const _Key, _Tp>; "; ";
14.00 map[/code] because you compare that with the acquiescence less<KEY>;. And the definition is : less<KEY>;
[code]template "Class _Tp>;
Struct less : public binary_function<_Tp, _Tp, bool>;
     {
Bool
Operator () (const _Tp& __x, const _Tp& __y) const
(Return __x "__y;)
It requires two parameters are the };[/code] CONST. So you write this operator< which is const, so here __x "You can not be deployed on the __y operator<. Add CONST you this is CONST this.

Stl map of China

Thank you, upstairs, has been resolved



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com