Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Namespaces | Functions
NCollection_ForwardRange.hxx File Reference

STL range-for adapter for OCCT iterators following the More()/Next() pattern. More...

#include <iterator>
#include <type_traits>
#include <utility>

Data Structures

struct  NCollection_ForwardRangeDetail::HasValue< T, typename >
 SFINAE: detect .Value() const. More...
 
struct  NCollection_ForwardRangeDetail::HasValue< T, std::void_t< decltype(std::declval< const T & >().Value())> >
 
struct  NCollection_ForwardRangeDetail::HasCurrent< T, typename >
 SFINAE: detect .Current() const. More...
 
struct  NCollection_ForwardRangeDetail::HasCurrent< T, std::void_t< decltype(std::declval< const T & >().Current())> >
 
struct  NCollection_ForwardRangeDetail::HasCurrentId< T, typename >
 SFINAE: detect .CurrentId() const. More...
 
struct  NCollection_ForwardRangeDetail::HasCurrentId< T, std::void_t< decltype(std::declval< const T & >().CurrentId())> >
 
struct  NCollection_ForwardRangeDetail::AccessorTraits< T, std::enable_if_t< HasValue< T >::value > >
 Priority 1: has Value() More...
 
struct  NCollection_ForwardRangeDetail::AccessorTraits< T, std::enable_if_t<!HasValue< T >::value &&HasCurrent< T >::value > >
 Priority 2: has Current() but not Value() More...
 
struct  NCollection_ForwardRangeDetail::AccessorTraits< T, std::enable_if_t<!HasValue< T >::value &&!HasCurrent< T >::value &&HasCurrentId< T >::value > >
 Priority 3: has CurrentId() but not Value() or Current() More...
 
struct  NCollection_ForwardRangeDetail::ArrowProxy< ValueT >
 Proxy for operator-> when the accessor returns a value (not a reference). More...
 
struct  NCollection_ForwardRangeSentinel
 Empty sentinel type used as the end marker for range-for loops. More...
 
class  NCollection_ForwardRangeIterator< HostType >
 STL input iterator that wraps an OCCT More()/Next() iterator. More...
 
struct  NCollection_ForwardRangeIterator< HostType >::PostfixProxy
 Postfix increment: captures the current value, then advances. Returns a proxy holding the old value (safe for non-copyable hosts). More...
 
class  NCollection_ForwardRange< HostType >
 Standalone range wrapper for OCCT iterators. More...
 

Namespaces

namespace  NCollection_ForwardRangeDetail
 

Functions

template<typename T >
 NCollection_ForwardRange (T &&) -> NCollection_ForwardRange< std::remove_reference_t< T > >
 CTAD deduction guide: deduces HostType from the constructor argument.
 

Detailed Description

STL range-for adapter for OCCT iterators following the More()/Next() pattern.

Provides reusable iterator/sentinel types that enable range-based for loops on any OCCT iterator or explorer class with More(), Next(), and a value accessor.

The value accessor is detected automatically via SFINAE with priority: Value() > Current() > CurrentId().

Two usage modes:

  1. In-class integration: add begin()/end() methods using the provided types.
    {
    }
    NCollection_ForwardRangeSentinel end() const { return {}; }
    GLuint GLuint end
    Definition OpenGl_glext.h:95
    STL input iterator that wraps an OCCT More()/Next() iterator.
    Definition NCollection_ForwardRange.hxx:142
    Empty sentinel type used as the end marker for range-for loops.
    Definition NCollection_ForwardRange.hxx:131
  2. Standalone wrapper for unmodified classes:
    for (const TopoDS_Shape& aFace :
    {
    // ...
    }
    @ TopAbs_FACE
    Definition TopAbs_ShapeEnum.hxx:51
    Standalone range wrapper for OCCT iterators.
    Definition NCollection_ForwardRange.hxx:246
    An Explorer is a Tool to visit a Topological Data Structure from the TopoDS package.
    Definition TopExp_Explorer.hxx:84
    Describes a shape which.
    Definition TopoDS_Shape.hxx:41

Function Documentation

◆ NCollection_ForwardRange()

template<typename T >
NCollection_ForwardRange ( T && ) -> NCollection_ForwardRange< std::remove_reference_t< T > >

CTAD deduction guide: deduces HostType from the constructor argument.