10 namespace onnxruntime {
18 template <
typename TNodesContainer>
21 template <
typename TIterator>
31 explicit ValidNodes(TNodesContainer& nodes) noexcept : nodes_(&nodes) {}
34 : nodes_(&nodes), filter_node_fn_{std::move(filter_node_fn)} {}
41 return {nodes_->cbegin(), nodes_->cend(), filter_node_fn_};
45 return {nodes_->cend(), nodes_->cend(), filter_node_fn_};
57 return {nodes_->crbegin(), nodes_->crend(), filter_node_fn_};
61 return {nodes_->crend(), nodes_->crend(), filter_node_fn_};
66 template <
typename T2 = TNodesContainer>
72 template <
typename T2 = TNodesContainer>
78 bool empty() const noexcept {
return nodes_->empty(); }
85 template <
typename TIterator>
97 using difference_type =
typename std::iterator_traits<TIterator>::difference_type;
104 : current_{current}, end_{
end}, apply_filter_{filter_fn !=
nullptr}, filter_func_{&filter_fn} {
106 while (current_ <
end && (*current_ ==
nullptr ||
107 (apply_filter_ && (*filter_func_)((*current_)->Index()) ==
true))) {
113 return (current_ == other.current_);
117 return (current_ != other.current_);
121 if (current_ < end_) {
122 while (++current_ != end_) {
123 if (*current_ !=
nullptr && (!apply_filter_ || (*filter_func_)((*current_)->Index()) ==
false))
144 return current_->get();
155 gsl::not_null<TNodesContainer*> nodes_;
bool empty() const noexcept
pointer operator->() const
typename std::iterator_traits< TIterator >::difference_type difference_type
NodeIterator< TIterator > operator++(int)
GLsizei const GLfloat * value
ConstNodeIterator cend() const noexcept
ConstNodeIterator begin() const noexcept
reference operator*() const
ConstNodeIterator cbegin() const noexcept
GraphNodes(std::vector< std::unique_ptr< Node >> &nodes)
NodeIterator< typename std::vector< std::unique_ptr< Node > >::const_reverse_iterator > ConstReverseNodeIterator
ValidNodes(TNodesContainer &nodes) noexcept
std::enable_if<!std::is_const< T2 >::value, MutableNodeIterator >::type begin() noexcept
std::enable_if<!std::is_const< T2 >::value, MutableNodeIterator >::type end() noexcept
bool operator!=(const NodeIterator< TIterator > &other) const noexcept
std::function< bool(NodeIndex)> NodeFilterFunc
ConstReverseNodeIterator rbegin() const noexcept
ConstNodeIterator end() const noexcept
std::input_iterator_tag iterator_category
bool operator==(const NodeIterator< TIterator > &other) const noexcept
ConstGraphNodes(const std::vector< std::unique_ptr< Node >> &nodes, GraphNodes::NodeFilterFunc &&filter_func)
ConstGraphNodes(const std::vector< std::unique_ptr< Node >> &nodes)
NodeIterator(const TIterator current, const TIterator end, const NodeFilterFunc &filter_fn) noexcept
ValidNodes(TNodesContainer &nodes, NodeFilterFunc &&filter_node_fn) noexcept
ConstReverseNodeIterator rend() const noexcept
NodeIterator< typename std::vector< std::unique_ptr< Node > >::const_iterator > ConstNodeIterator
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate and *a name There is also one special expression reference
const T & const_reference
NodeIterator< typename std::vector< std::unique_ptr< Node > >::iterator > MutableNodeIterator