typedef map<int, string, less<int> > INT2STRING;
map<>中的各代表什么。看不明白

解决方案 »

  1.   

    第一个是Key,第二个是Value,第三个是比较函数。
      

  2.   

    一般map只是2叉树类型 这个less<int>是怎么回事呢
      

  3.   

    less说是一个小于的算法呗,应该是一个模板函数,less<int>就是针对int类型的嘛
      

  4.   

     
    template <
       class Key, 
       class Type, 
       class Traits = less<Key>, 
          class Allocator=allocator<pair <const Key, Type> > 
    >
    class map
     Parameters
    Key
    The key data type to be stored in the map. Type
    The element data type to be stored in the map. Traits
    The type that provides a function object that can compare two element values as sort keys to determine their relative order in the map. This argument is optional and the binary predicate less<Key> is the default value. Allocator
    The type that represents the stored allocator object that encapsulates details about the map's allocation and deallocation of memory. This argument is optional and the default value is allocator<pair <const Key, Type> >. 
      

  5.   

    一般的map内部自建一种非严格意义上的平衡二叉树,这颗树具有对数据自动排序的功能.问下map中的 less<int>是比较函数 怎么给key排序的。
      

  6.   

    less<int>是一个标准类,用于形成降序排列函数对象。升序排列是用greater<int>。通过指定某一预先定义的区间来初始化set对象的构造函数:
     总结一下