MySQL 9.1.0
Source Code Documentation
visible_fields.h File Reference

An adapter class to support iteration over an iterator of Item * (typically mem_root_deque<Item *>), while skipping over items that are hidden (item->hidden == true). More...

#include <iterator>
#include "mem_root_deque.h"
#include "sql/item.h"

Go to the source code of this file.

Classes

class  VisibleFieldsAdapter< Iterator >
 
class  VisibleFieldsContainer< Container, Iterator >
 

Typedefs

using VisibleFieldsIterator = VisibleFieldsContainer< mem_root_deque< Item * >, mem_root_deque< Item * >::iterator >
 
using VisibleFieldsConstIterator = VisibleFieldsContainer< const mem_root_deque< Item * >, mem_root_deque< Item * >::const_iterator >
 

Functions

VisibleFieldsIterator VisibleFields (mem_root_deque< Item * > &fields)
 
VisibleFieldsConstIterator VisibleFields (const mem_root_deque< Item * > &fields)
 

Detailed Description

An adapter class to support iteration over an iterator of Item * (typically mem_root_deque<Item *>), while skipping over items that are hidden (item->hidden == true).

This is such a common operation that it warrants having its own adapter. You can either do

for (Item *item : VisibleFields(fields))

or use select->visible_fields().

Behavior is undefined if you modify the hidden flag of an item during iteration.

TODO(sgunders): When we get C++20, replace with an std::views::filter.

Typedef Documentation

◆ VisibleFieldsConstIterator

◆ VisibleFieldsIterator

Function Documentation

◆ VisibleFields() [1/2]

VisibleFieldsConstIterator VisibleFields ( const mem_root_deque< Item * > &  fields)
inline

◆ VisibleFields() [2/2]

VisibleFieldsIterator VisibleFields ( mem_root_deque< Item * > &  fields)
inline