mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
??????: Fix error of TKernal and TMath compilation.
Error occured if using c++20 standard with new oneTBB 2021.5.0. The error was: Error C2672 'tbb::v1::parallel_for_each': no matching overloaded function found TKernel could be 'void tbb::detail::d2::parallel_for_each(Iterator,Iterator,const Body &)' TKernel 'tbb::detail::d2::parallel_for_each': the associated constraints are not satisfied TKernel Note, that if we use c++14 or c++17, all ok, error does not occures. To solve the problem, i have to modify `UniversalIterator` class: `value_type` instead `UniversalIterator` converted to `IteratorInterface*` `pointer` = `reference` = `value_type` Method `DownCast` moved into `FunctorInterface` abstract class. argument `UniversalIterator& item` of the unary fuctions converted to `IteratorInterface*`. The proposed solution solved the compilation error.
This commit is contained in:
@@ -125,10 +125,10 @@ protected:
|
||||
|
||||
// Since C++20 inheritance from std::iterator is deprecated, so define predefined types manually:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = UniversalIterator;
|
||||
using value_type = IteratorInterface*;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = UniversalIterator*;
|
||||
using reference = UniversalIterator&;
|
||||
using pointer = value_type;
|
||||
using reference = value_type;
|
||||
|
||||
UniversalIterator() {}
|
||||
|
||||
@@ -171,18 +171,8 @@ protected:
|
||||
return aValue;
|
||||
}
|
||||
|
||||
const UniversalIterator& operator* () const { return *this; }
|
||||
UniversalIterator& operator* () { return *this; }
|
||||
|
||||
const UniversalIterator* operator->() const { return this; }
|
||||
UniversalIterator* operator->() { return this; }
|
||||
|
||||
// type cast to actual iterator
|
||||
template <typename Iterator>
|
||||
const Iterator& DownCast () const
|
||||
{
|
||||
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(myPtr.get())->Value();
|
||||
}
|
||||
const reference operator* () const { return myPtr.get(); }
|
||||
reference operator* () { return myPtr.get(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<IteratorInterface> myPtr;
|
||||
@@ -196,7 +186,14 @@ protected:
|
||||
public:
|
||||
virtual ~FunctorInterface() {}
|
||||
|
||||
virtual void operator () (UniversalIterator& theIterator) const = 0;
|
||||
virtual void operator () (IteratorInterface* theIterator) const = 0;
|
||||
|
||||
// type cast to actual iterator
|
||||
template <typename Iterator>
|
||||
static const Iterator& DownCast(IteratorInterface* theIterator)
|
||||
{
|
||||
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(theIterator)->Value();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -211,9 +208,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
|
||||
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
|
||||
{
|
||||
const Iterator& anIt = theIterator.DownCast<Iterator>();
|
||||
const Iterator& anIt = DownCast<Iterator>(theIterator);
|
||||
myFunctor(*anIt);
|
||||
}
|
||||
|
||||
@@ -233,9 +230,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
|
||||
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
|
||||
{
|
||||
Standard_Integer anIndex = theIterator.DownCast<Standard_Integer>();
|
||||
Standard_Integer anIndex = DownCast<Standard_Integer>(theIterator);
|
||||
myFunctor(anIndex);
|
||||
}
|
||||
|
||||
|
@@ -100,7 +100,7 @@ namespace
|
||||
{
|
||||
for (OSD_Parallel::UniversalIterator anIter = myRange.It(); anIter != myRange.End(); anIter = myRange.It())
|
||||
{
|
||||
myPerformer (anIter);
|
||||
myPerformer (*anIter);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user