View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002749 | OpenFOAM | Bug | public | 2017-11-02 16:13 | 2017-11-06 09:58 |
Reporter | chaohsiung | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Fixed in Version | dev | ||||
Summary | 0002749: iterator operator | ||||
Description | Do we really need this sizeof(T*)? iterx.ptr_ is already defined as T**. //----------------------- // UPtrListI.H template<class T> inline Foam::label Foam::operator- ( const typename UPtrList<T>::const_iterator& iter1, const typename UPtrList<T>::const_iterator& iter2 ) { return (iter1.ptr_ - iter2.ptr_)/sizeof(T*); } //------------------------- I've tested the revised operator by removing the sizeof(T*): int main() { UPtrList<int> ptrL(10); UPtrList<int>::iterator it1 = ptrL.begin(); UPtrList<int>::iterator it2 = ptrL.end(); std::cout << "sizeof(int*):\t" << sizeof(int*) << std::endl; std::cout << "it2-it1:\t" << it2-it1 << std::endl; std::cout << "(it2-it1)/sizeof(int*):\t" << (it2-it1)/sizeof(int*) << std::endl; return 0; } //---------------------------- The result is sizeof(int*): 8 it2-it1: 10 (it2-it1)/sizeof(int*): 1 | ||||
Tags | No tags attached. | ||||
|
Which OpenFOAM version, OS and compiler are you using? When compiling your example with OpenFOAM-dev, gcc-7.2.1 or clang-4.0.1 I get error messages of the form "couldn't deduce template parameter âTâ" and it does not compile. |
|
Resolved by commit 36dcb28511744d8d9fa4e89c1e27dc06b57fd440 |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-11-02 16:13 | chaohsiung | New Issue | |
2017-11-02 16:46 | henry | Note Added: 0008984 | |
2017-11-06 09:58 | henry | Assigned To | => henry |
2017-11-06 09:58 | henry | Status | new => resolved |
2017-11-06 09:58 | henry | Resolution | open => fixed |
2017-11-06 09:58 | henry | Fixed in Version | => dev |
2017-11-06 09:58 | henry | Note Added: 0009003 |