MySQL  8.0.27
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 "mem_root_deque.h"
#include "sql/item.h"

Go to the source code of this file.

Classes

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

Functions

auto VisibleFields (mem_root_deque< Item * > &fields)
 
auto 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.

Function Documentation

◆ VisibleFields() [1/2]

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

◆ VisibleFields() [2/2]

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