diff --git a/src/NCollection/NCollection_StlIterator.hxx b/src/NCollection/NCollection_StlIterator.hxx index 78fa3cf150..735ba0e862 100644 --- a/src/NCollection/NCollection_StlIterator.hxx +++ b/src/NCollection/NCollection_StlIterator.hxx @@ -26,13 +26,17 @@ //! iterator requires Offset and Differ methods. See NCollection_Vector as //! example of declaring custom STL iterators. template -class NCollection_StlIterator : - public std::iterator::type, - typename std::conditional::type> +class NCollection_StlIterator { public: + // Since C++20 inheritance from std::iterator is deprecated, so define predefined types manually: + using iterator_category = Category; + using value_type = ItemType; + using difference_type = ptrdiff_t; + using pointer = typename std::conditional::type; + using reference = typename std::conditional::type; + //! Default constructor NCollection_StlIterator () {} diff --git a/src/OSD/OSD_Parallel.hxx b/src/OSD/OSD_Parallel.hxx index b3dd8d0d47..2dab32050f 100644 --- a/src/OSD/OSD_Parallel.hxx +++ b/src/OSD/OSD_Parallel.hxx @@ -118,12 +118,19 @@ protected: //! iteration over objects subject to parallel processing. //! It stores pointer to instance of polymorphic iterator inheriting from //! IteratorInterface, which contains actual type-specific iterator. - class UniversalIterator : + class UniversalIterator // Note that TBB requires that value_type of iterator be copyable, // thus we use its own type for that - public std::iterator { public: + + // 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 difference_type = ptrdiff_t; + using pointer = UniversalIterator*; + using reference = UniversalIterator&; + UniversalIterator() {} UniversalIterator(IteratorInterface* theOther)