|
| items () |
| Create empty items list. More...
|
|
| items (const T &t) |
| Create items list with one element. More...
|
|
| 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. More...
|
|
items & | operator() (const T &t) |
| Add element to items list. More...
|
|
template<typename T = PGSTD::string, typename CONT = PGSTD::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.