# Glib::Variant< VariantBase > Class Template Reference
Variant Data Types

Specialization of Variant containing a VariantBase. More...

`#include <glibmm/variant.h>`

Inheritance diagram for Glib::Variant< VariantBase >:
[legend]

List of all members.

## Public Types

typedef GVariant* | CType
typedef VariantBase | CppType
typedef Variant< VariantBase > | CppContainerType

## Public Member Functions

| Variant ()
| Default constructor.
| Variant (GVariant* castitem, bool take_a_reference=false)
| GVariant constructor.
void | get (VariantBase& variant) const
VariantBase | get () const
| Unboxes value.

## Static Public Member Functions

static const VariantType& | variant_type ()
| Gets the VariantType.
static Variant< VariantBase > | create (const VariantBase& data)
| Creates a new Variant<VariantBase>.

## Detailed Description

### template<>
class Glib::Variant< VariantBase >

Specialization of Variant containing a VariantBase.

Since glibmm 2.28:

## Member Typedef Documentation

typedef Variant<VariantBase> Glib::Variant< VariantBase >::CppContainerType

typedef VariantBase Glib::Variant< VariantBase >::CppType

Reimplemented from Glib::VariantContainerBase.

typedef GVariant* Glib::Variant< VariantBase >::CType

Reimplemented from Glib::VariantContainerBase.

## Constructor & Destructor Documentation

Glib::Variant< VariantBase >::Variant | ( |  | ) |

Default constructor.

Glib::Variant< VariantBase >::Variant | ( | GVariant< VariantBase >* | castitem,
|  | bool | take_a_reference = `false`
| ) |  | `[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

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

Creates a new Variant<VariantBase>.

Parameters:

  data | The value of the new Variant.

Returns:
  The new Variant.

Since glibmm 2.28:

VariantBase Glib::Variant< VariantBase >::get | ( |  | ) | const

Unboxes value.

The result is the Variant instance that was contained in value.

Since glibmm 2.24:

Returns:
  The item contained in the variant.

void Glib::Variant< VariantBase >::get | ( | VariantBase& | variant | ) | const

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

Gets the VariantType.

Returns:
  The VariantType.

Since glibmm 2.28: