mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
include/elist: Fix clear() to use pop_front()
elist<T>::clear() is calling remove(), which isn't a method defined on elist<T> (it was never defined according to git). Because elist is templated and no references to clear() are ever made, the compiler matches remove(T) to the remove(const char *) system call defined in stdio.h. Once clear is invoked on an instance of elist<T>, we get the compile error shown below. The fix here is to use pop_front() instead of remove(). Compile error is: In file included from ../../src/mds/CInode.h:22:0, from ../../src/mds/CInode.cc:19: ../../src/include/elist.h: In instantiation of ‘void elist<T>::clear() [with T = cinode_backtrace_info_t*]’: ../../src/mds/CInode.cc:1129:20: required from here ../../src/include/elist.h:101:7: error: no matching function for call to ‘remove(cinode_backtrace_info_t*)’ ../../src/include/elist.h:101:7: note: candidates are: In file included from ../../src/mds/CInode.cc:17:0: /usr/include/stdio.h:179:12: note: int remove(const char*) /usr/include/stdio.h:179:12: note: no known conversion for argument 1 from ‘cinode_backtrace_info_t*’ to ‘const char*’ In file included from /usr/include/c++/4.7/algorithm:63:0, from /usr/include/c++/4.7/backward/hashtable.h:65, from /usr/include/c++/4.7/ext/hash_map:65, from ../../src/include/encoding.h:292, from ../../src/common/entity_name.h:22, from ../../src/common/config.h:26, from ../../src/mds/CInode.h:20, from ../../src/mds/CInode.cc:19: /usr/include/c++/4.7/bits/stl_algo.h:1117:5: note: template<class _FIter, class _Tp> _FIter std::remove(_FIter, _FIter, const _Tp&) /usr/include/c++/4.7/bits/stl_algo.h:1117:5: note: template argument deduction/substitution failed: In file included from ../../src/mds/CInode.h:22:0, from ../../src/mds/CInode.cc:19: ../../src/include/elist.h:101:7: note: candidate expects 3 arguments, 1 provided Signed-off-by: Sam Lang <sam.lang@inktank.com> Reviewed-by: Greg Farnum <greg@inktank.com>
This commit is contained in:
parent
b8fb2ee0f7
commit
fb07745c75
@ -98,7 +98,7 @@ public:
|
||||
|
||||
void clear() {
|
||||
while (!_head.empty())
|
||||
remove(front());
|
||||
pop_front();
|
||||
}
|
||||
|
||||
void push_front(item *i) {
|
||||
|
Loading…
Reference in New Issue
Block a user