glibmm: Glib::Variant< std::vector< T > > Class Template Reference

glibmm 2.28.2

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

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

Public Types | Public Member Functions | Static Public Member Functions
Glib::Variant< std::vector< T > > Class Template Reference
Variant Data Types

Specialization of Variant containing an array of items. More...

`#include <glibmm/variant.h>`

Inheritance diagram for Glib::Variant< std::vector< T > >:
[legend]

List of all members.

## Public Types
typedef T | CppType
typedef std::vector< T > | CppContainerType
## Public Member Functions
| Variant ()
| Default constructor.
| Variant (GVariant* castitem, bool take_a_reference=false)
| GVariant constructor.
T | get_child (gsize index) const
| Gets a specific element of the array.
std::vector< T > | get () const
| Gets the vector of the Variant.
VariantIter | get_iter () const
| Gets a VariantIter of the Variant.
## Static Public Member Functions
static const VariantType& | variant_type ()
| Gets the VariantType.
static Variant< std::vector< T > > | create (const std::vector< T >& data)
| Creates a new Variant from an array of numeric types.

## Detailed Description

### template<class T>
class Glib::Variant< std::vector< T > >

Specialization of Variant containing an array of items.

Since glibmm 2.28:

## Member Typedef Documentation

template <class T >

typedef std::vector<T> Glib::Variant< std::vector< T > >::CppContainerType

template <class T >

typedef T Glib::Variant< std::vector< T > >::CppType

Reimplemented from Glib::VariantContainerBase.

## Constructor & Destructor Documentation

template <class T >

Glib::Variant< std::vector< T > >::Variant | ( |  | ) | `[inline]`

Default constructor.

template <class T >

Glib::Variant< std::vector< T > >::Variant | ( | GVariant< std::vector< T > > * | castitem,
|  | bool | take_a_reference = `false`
| ) |  | `[inline, explicit]`

GVariant constructor.

Parameters:

  castitem | The GVariant to wrap.
  take_a_reference | Whether to take an extra reference of the GVariant or not (not taking one could destroy the GVariant with the wrapper).

## Member Function Documentation

template <class T >

Variant< std::vector< T > > Glib::Variant< std::vector< T > >::create | ( | const std::vector< T > & | data | ) | `[static]`

Creates a new Variant from an array of numeric types.

Parameters:

  data | The array to use for creation.

Returns:
  The new Variant.

Since glibmm 2.28:

template <class T >

std::vector< T > Glib::Variant< std::vector< T > >::get | ( |  | ) | const

Gets the vector of the Variant.

Returns:
  The vector.

Since glibmm 2.28:

template <class T >

T Glib::Variant< std::vector< T > >::get_child | ( | gsize | index | ) | const

Gets a specific element of the array.

It is an error if index is greater than the number of child items in the container. See VariantContainerBase::get_n_children().

This function is O(1).

Parameters:

  index | The index of the element.

Returns:
  The element at index .

Exceptions:

  std::out_of_range |

Since glibmm 2.28:

template <class T >

VariantIter Glib::Variant< std::vector< T > >::get_iter | ( |  | ) | const

Gets a VariantIter of the Variant.

Returns:
  the VaraintIter.

Since glibmm 2.28:

template <class T >

const VariantType& Glib::Variant< std::vector< T > >::variant_type | ( |  | ) | `[static]`

Gets the VariantType.

Returns:
  The VariantType.

Since glibmm 2.28: