List类的问题
-
因为需要用到一些只能在com跑的工具箱,所以笔者打算将之前写的代码从Org版本迁移到com版本,但是发现自己掉坑里了。具体报错如下:
In file included from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/List.H:322:0, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/HashTable.C:30, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/Istream.H:184, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/ISstream.H:39, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/IOstreams.H:38, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/VectorSpace.C:27, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/VectorSpace.H:233, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/Vector.H:44, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/vector.H:39, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/point.H:35, from lnInclude/mooringLine.H:39, from lnInclude/ICC.H:39, from QCC/QCC.H:39, from QCC/QCC.C:26: /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/List.C: In instantiation of ‘Foam::List<T>::List(InputIterator, InputIterator) [with InputIterator = int; T = double]’: QCC/QCC.C:230:40: required from here /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/List.C:213:44: error: no matching function for call to ‘distance(int&, int&)’ List<T>(begIter, endIter, std::distance(begIter, endIter)) ^ In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0, from /usr/include/c++/5/bits/char_traits.h:39, from /usr/include/c++/5/string:40, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/string.H:51, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/word.H:43, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/int32.H:43, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/int.H:38, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/label.H:39, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/doubleFloat.H:29, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/floatScalar.H:38, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/scalar.H:39, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/vector.H:38, from /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/point.H:35, from lnInclude/mooringLine.H:39, from lnInclude/ICC.H:39, from QCC/QCC.H:39, from QCC/QCC.C:26: /usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: note: candidate: template<class _InputIterator> typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator) distance(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: note: template argument deduction/substitution failed: /usr/include/c++/5/bits/stl_iterator_base_funcs.h: In substitution of ‘template<class _InputIterator> typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = int]’: /home/cybrex/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/List.C:213:44: required from ‘Foam::List<T>::List(InputIterator, InputIterator) [with InputIterator = int; T = double]’ QCC/QCC.C:230:40: required from here /usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: error: no type named ‘difference_type’ in ‘struct std::iterator_traits<int>’
通过代码可以定位到类的一个成员函数,这里我声明了2个ScalarList与2个VectorList,然后会出现这个错误。
但是这个类的变量里面是有其他ScalarList以及VectorList的,所以个人觉得坑应该是在成员函数声明List 类的问题上,
但是又不太清楚这么底层的东西该如何修改,望各位赐教!谢谢!