PIP  0.4.0_beta2
Platform-Independent Primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
picontainers.h File Reference

Generic containers. More...

Classes

class  PISet< Type, Compare, Allocator >
 Set of any type. More...
 

Macros

#define piForeach(i, c)
 Macro for iterate any container. More...
 
#define piForeachR(i, c)
 Macro for iterate any container with reverse direction. More...
 
#define piForeachC(i, c)
 Macro for iterate any container only for read. More...
 
#define piForeachCR(i, c)
 Macro for iterate any container only for read with reverse direction. More...
 

Detailed Description

Generic containers.

Stack container.

Queue container.

This file declare all containers and useful macros to use them

This file declare PIQueue

This file declare PIStack

Macro Definition Documentation

#define piForeach (   i,
 
)
Value:
for(_PIForeach<typeof(c)> _for(c); !_for.isEnd(); ++_for) \
for(i(*_for._it); !_for._break; _for._break = true)

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:

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 piForeachR (   i,
 
)
Value:
for(_PIForeachR<typeof(c)> _for(c); !_for.isEnd(); ++_for) \
for(i(*_for._rit); !_for._break; _for._break = true)

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:

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 piForeachC (   i,
 
)
Value:
for(_PIForeachC<typeof(c)> _for(c); !_for.isEnd(); ++_for) \
for(const i(*_for._it); !_for._break; _for._break = true)

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:

vec << 1 << 2 << 3;
piForeachC (int & i, vec)
cout << i << ", ";
// 1, 2, 3,
piForeachC (int & i, vec)
i++; // ERROR! const iterator
#define piForeachCR (   i,
 
)
Value:
for(_PIForeachCR<typeof(c)> _for(c); !_for.isEnd(); ++_for) \
for(const i(*_for._rit); !_for._break; _for._break = true)

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:

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