glibmm 2.88.0

Public Types | Public Member Functions | Static Public Member Functions | List of all members
Glib::Value< T, Enable > Class Template Reference
Generic Values

Generic value implementation for custom types. More...

`#include <glibmm/value_custom.h>`

Inheritance diagram for Glib::Value< T, Enable >:
[legend]

## Public Types
using | CppType = T

## Public Member Functions
void | set (const CppType & data)
CppType | get () const
Public Member Functions inherited from Glib::ValueBase
| ValueBase ()
| Initializes the GValue, but without a type.
| ValueBase (const ValueBase & other)
ValueBase & | operator= (const ValueBase & other)
| ~ValueBase () noexcept
void | init (GType type)
| Setup the GValue for storing the specified type.
void | init (const GValue * value)
| Setup the GValue storing the type and value of the specified value.
void | reset ()
| Reset contents to the default value of its type.
GValue * | gobj ()
const GValue * | gobj () const

## Static Public Member Functions
static GType | value_type ()
Static Public Member Functions inherited from Glib::ValueBase_Boxed
static GType | value_type ()

## Additional Inherited Members
Protected Member Functions inherited from Glib::ValueBase_Boxed
void | set_boxed (const void * data)
void * | get_boxed () const
Protected Attributes inherited from Glib::ValueBase
GValue | gobject_

## Detailed Description

template<class T, typename Enable = void>
class Glib::Value< T, Enable >

Generic value implementation for custom types.

Any type to be used with this template must implement:

- default constructor
- copy constructor
- assignment operator
- destructor

Compiler-generated implementations are OK, provided they do the right thing for the type. In other words, any type that works with std::vector will work with Glib::Value<>.

Note
  None of the operations listed above are allowed to throw. If you cannot ensure that no exceptions will be thrown, consider using either a normal pointer or a smart pointer to hold your objects indirectly.

## Member Typedef Documentation

## ◆ CppType

template <class T, typename Enable = void>

using Glib::Value< T, Enable >::CppType = T

## Member Function Documentation

## ◆ get()

template <class T, typename Enable = void>

CppType Glib::Value< T, Enable >::get | ( |  | ) | const
| inline

## ◆ set()

template <class T, typename Enable = void>

void Glib::Value< T, Enable >::set | ( | const CppType & | data | ) |
| inline

## ◆ value_type()

template <class T, typename Enable = void>

GType Glib::Value< T, Enable >::value_type | ( |  | ) |
| static