# Element< S, T > Class Template Reference
[Fundamental C++: the Element design pattern.]

Glue class between structural elements and implementation values. More...

Inheritance diagram for Element< S, T >:
[legend]

List of all members.

## Public Types

typedef S | set_t
| Structure type for structural elements.
typedef T | value_t
| Implementation type for values.

## Public Member Functions

| Element ()
| Default constructor.
| Element (const Element &other)
| Copy constructor from `Element` instances of exactly the same type.
template<typename U >
| Element (const Element< S, U > &other)
| Copy constructor from `Element` instances with different value type.
template<typename OtherS , typename U >
| Element (const Element< OtherS, U > &other)
| Copy constructor from foreign `Element` instances.
| Element (const S &structure)
| Default constructor with the structural element specified.
| Element (const S &structure, const T &other)
| Explicit construction from structural element and value.
template<typename U >
| Element (const S &structure, const U &other)
| Explicit construction from structural element and foreign value.
template<typename OtherS , typename U >
| Element (const S &structure, const Element< OtherS, U > &other)
| Explicit construction with foreign `Element` conversion.
Element & | operator= (const Element &other)
| Assignment from the same `Element` type.
template<typename U >
Element & | operator= (const Element< S, U > &other)
| Assignment from other implementation value types.
template<typename OtherS , typename U >
Element & | operator= (const Element< OtherS, U > &other)
| Assignment from foreign `Element` types.
template<typename U >
Element & | operator= (const U &other)
| Assignment from foreign implementation types.
const S & | structure () const
| Accessor to the structural element.
void | attach (const S &structure)
| Post-construction link to a structural element.
| Element (const T &other)
| Copy constructor from anonymous values.
template<typename U >
| Element (const U &other)
| Copy constructor from anonymous values.
T & | value ()
| Accessor to the value data.
const T & | value () const
| Accessor to the value data.

## Static Public Attributes

static const bool | dynamic
| Attribute indicating whether Element instances have run-time data.

## Private Member Functions

const S & | _structure_get () const
| Access to the instance of the structural element.
bool | _structure_bound () const
| Whether the current set slot is linked to a structural element.
Methods to link the Slot
Because this version of the class pertains to static S.E. 's, those methods actually do nothing and calls to it should be optimized away.
void | _structure_assign (const SetSlotAttribute &other)
| Link a `SetSlot` to another.
void | _structure_attach (const S &other)
| Link a `SetSlot` to a structural element.

## Detailed Description

### template<typename S, typename T>
class vcsn::Element< S, T >

Glue class between structural elements and implementation values.

`Element` is the center of the design pattern used in Vaucanson to have an orthogonal construction of object from two different viewpoints:

- Algebraic/Theoretical one, from a hierarchy of structures,
- Implementation and computations.

`Element` proposes a lot of different constructors so as to allow the largest structure of type conversions. Calling foreign constructors assumes that there exist compatible `op_convert()` functions.

See also:
  - `MetaElement`
  - `Structure`
  - `SetSlot`

Definition at line 61 of file element.hh.

## Constructor & Destructor Documentation

Element | ( |  | ) |

Default constructor.

It is not possible to use this contructor when the structural element has dynamic data. If you absolutely need to do so, notice that it may be dangerous, and see misc::Deferrer.

See also:
  misc::Deferrer

Definition at line 30 of file element.hxx.

Element | ( | const Element< OtherS, U > & | other | ) |

Copy constructor from foreign `Element` instances.

Impossible to use when the structural element has dynamic data since it leaves it uninitialized.

Definition at line 59 of file element.hxx.

Element | ( | const T & | other | ) |

Copy constructor from anonymous values.

Impossible to use when the structural element has dynamic data since it leaves it uninitialized.

Definition at line 71 of file element.hxx.

Element | ( | const U & | other | ) |

Copy constructor from anonymous values.

Impossible to use when the structural element has dynamic data since it leaves it uninitialized.

Definition at line 81 of file element.hxx.

Element | ( | const S & | structure | ) | `[explicit]`

Default constructor with the structural element specified.

Invokes the default constructor of the implementation value type.

Definition at line 94 of file element.hxx.