这就是我想要实现的目标
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 | |
| ------------------------------------------------------ |
-------------------------------------------------------------- … 类:
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)