libpqxx: pqxx::items< T, CONT > Class Template Reference

libpqxx 4.0.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
pqxx::items< T, CONT > Class Template Reference

Container of items with easy contents initialization and string rendering. More...

`#include <util.hxx>`

## Public Member Functions
| items ()
| Create empty items list.
| items (const T &t)
| Create items list with one element.
| items (const T &t1, const T &t2)
| items (const T &t1, const T &t2, const T &t3)
| items (const T &t1, const T &t2, const T &t3, const T &t4)
| items (const T &t1, const T &t2, const T &t3, const T &t4, const T &t5)
| items (const CONT &c)
| Copy container.
items & | operator() (const T &t)
| Add element to items list.

## Detailed Description

### template<typename T = std::string, typename CONT = std::vector<T>>
class pqxx::items< T, CONT >

Container of items with easy contents initialization and string rendering.

Designed as a wrapper around an arbitrary container type, this class lets you easily create a container object and provide its contents in the same line. Regular addition methods such as push_back() will also still work, but you can now write things like

items<int> numbers; numbers(1)(2)(3)(4);

Up to five elements may be specified directly as constructor arguments, e.g.

items<int> numbers(1,2,3,4);

One thing that cannot be done with this simple class is create const objects with nontrivial contents. This is because the function invocation operator (which is being used to add items) modifies the container rather than creating a new one. This was done to keep performance within reasonable bounds.

Warning
  This class may see substantial change in its interface before it stabilizes. Do not count on it remaining the way it is.

## Constructor & Destructor Documentation

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( |  | ) |

Create empty items list.

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( | const T & | t | ) |
| explicit

Create items list with one element.

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( | const T & | t1,
|  | const T & | t2
| ) |  |

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( | const T & | t1,
|  | const T & | t2,
|  | const T & | t3
| ) |  |

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( | const T & | t1,
|  | const T & | t2,
|  | const T & | t3,
|  | const T & | t4
| ) |  |

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( | const T & | t1,
|  | const T & | t2,
|  | const T & | t3,
|  | const T & | t4,
|  | const T & | t5
| ) |  |

template<typename T = std::string, typename CONT = std::vector<T>>

pqxx::items< T, CONT >::items | ( | const CONT & | c | ) |

Copy container.

## Member Function Documentation

template<typename T = std::string, typename CONT = std::vector<T>>

items& pqxx::items< T, CONT >::operator() | ( | const T & | t | ) |

Add element to items list.

The documentation for this class was generated from the following file:

- util.hxx