小编enc*_*097的帖子

CSS将容器缩小到两个动态宽度div的大小

这就是我想要实现的目标

                            CONTAINER
 --------------------------------------------------------------
|                      CENTERED in CONTAINER                   |
|    -----------------------------------------   ----------    |
|   | Content Div                             | | Info Div |   |
|   | shrink to contents  OR                  | | shrink to|   |
|   | max size: (container width - info div ) | | contents |   |
|   |                                         |  ----------    |
|    -----------------------------------------                 |
|                                                              |
|    ------------------------------------------------------    |
|   |  text div: width = width of content div + info div   |   |
|    ------------------------------------------------------    |
 -------------------------------------------------------------- …

html css

10
推荐指数
2
解决办法
9239
查看次数

C++ std列表使用自定义比较器排序,该比较器依赖于对象实例的成员变量

类:

Class:
  private:
    ...
    vector<string> words; 
    vector< list<int> > vints;
  public:
    myFunction(...)
Run Code Online (Sandbox Code Playgroud)

我在另一个成员函数中调用非空列表中的排序:

void myClass::myFunction (...) {
    ...
    if (!vints[i].empty()) vints[i].sort(sortFunc);
    ...
}
Run Code Online (Sandbox Code Playgroud)

我的排序功能:

bool myClass::sortFunc(const int& i, const int& j) { return (words[i] < words[j]); }
Run Code Online (Sandbox Code Playgroud)

错误:

error: no matching function for call to ‘std::list<int, std::allocator<int>      >::sort(<unresolved overloaded function type>)’
/usr/include/c++/4.4/bits/list.tcc:301: note: candidates are: void std::list<_Tp,     _Alloc>::sort() [with _Tp = int, _Alloc = std::allocator<int>]
/usr/include/c++/4.4/bits/list.tcc:378: note:                 void std::list<_Tp, _    Alloc>::sort(_StrictWeakOrdering) [with _StrictWeakOrdering = bool (SuperWordSearch::*)    (const int&, const int&), …
Run Code Online (Sandbox Code Playgroud)

c++ sorting list std

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

css ×1

html ×1

list ×1

sorting ×1

std ×1