# PIP: src/containers/picontainers.h File Reference

picontainers.h File Reference

Generic containers. More...

## Macros

#define | piForeach(i, c)
| Macro for iterate any container. More...
#define | piForeachC(i, c)
| Macro for iterate any container only for read. More...
#define | piForeachR(i, c)
| Macro for iterate any container with reverse direction. More...
#define | piForeachCR(i, c)
| Macro for iterate any container only for read with reverse direction. More...
#define | piBreak
| Macro for break from any piForeach* loop. More...

## Detailed Description

Generic containers.

Queue container.

This file declare all containers and useful macros to use them

This file declare PIQueue

## Macro Definition Documentation

#define piForeach | ( |  | i,
|  |  | c
| ) |  |

Macro for iterate any container.

Use this macros instead of standard "for" to get read/write access to each element of container. Pass direction is direct
Example:

PIVector<int> vec;
vec << 1 << 2 << 3;
piForeach (int & i, vec)
cout << i << ", ";
// 1, 2, 3,
piForeach (int & i, vec)
i++;
piForeach (int & i, vec)
cout << i << ", ";
// 2, 3, 4,

#define piForeachC | ( |  | i,
|  |  | c
| ) |  |

Macro for iterate any container only for read.

Use this macros instead of standard "for" to get read access to each element of container. Pass direction is direct
Example:

PIVector<int> vec;
vec << 1 << 2 << 3;
piForeachC (int & i, vec)
cout << i << ", ";
// 1, 2, 3,
piForeachC (int & i, vec)
i++; // ERROR! const iterator

#define piForeachR | ( |  | i,
|  |  | c
| ) |  |

Macro for iterate any container with reverse direction.

Use this macros instead of standard "for" to get read/write access to each element of container. Pass direction is reverse
Example:

PIVector<int> vec;
vec << 1 << 2 << 3;
piForeachR (int & i, vec)
cout << i << ", ";
// 3, 2, 1,
piForeachR (int & i, vec)
i++;
piForeachR (int & i, vec)
cout << i << ", ";
// 4, 3, 2,

#define piForeachCR | ( |  | i,
|  |  | c
| ) |  |

Macro for iterate any container only for read with reverse direction.

Use this macros instead of standard "for" to get read access to each element of container. Pass direction is reverse
Example:

PIVector<int> vec;
vec << 1 << 2 << 3;
piForeachCR (int & i, vec)
cout << i << ", ";
// 3, 2, 1,
piForeachCR (int & i, vec)
i++; // ERROR! const iterator

#define piBreak

Macro for break from any piForeach* loop.

Warning
  C++ ordinary "break" doesn`t work inside piForeach* loops! Always use "piBreak" instead!