# xoptional_assembly

Defined in `xtensor/optional/xoptional_assembly.hpp`

template<class VE, class FE>
class xoptional_assembly : public xt::xoptional_assembly_base<xoptional_assembly<VE, FE>>, public xt::xcontainer_semantic<xoptional_assembly<VE, FE>>

  Dense multidimensional container holding optional values, optimized for tensor operations.

  The xoptional_assembly class implements a dense multidimensional container hoding optional values. This container is optimized of tensor operations: contrary to xarray_optional, xoptional_assembly holds two separated expressions, one for the values, the other for the missing mask.

  Template Parameters:

    - VE – The type of expression holding the values.

    - FE – The type of expression holding the missing mask.

  Constructors

  inline xoptional_assembly()

    Allocates an uninitialized xoptional_assembly that holds 0 element.

  inline explicit xoptional_assembly(const shape_type &shape, layout_type l = base_type::static_layout)

    Allocates an uninitialized xoptional_assembly with the specified shape and layout_type.

    Parameters:

      - shape – the shape of the xoptional_assembly

      - l – the layout_type of the xoptional_assembly

  inline explicit xoptional_assembly(const shape_type &shape, const value_type &value, layout_type l = base_type::static_layout)

    Allocates an xoptional_assembly with the specified shape and layout_type.

    Elements are initialized to the specified value.

    Parameters:

      - shape – the shape of the xoptional_assembly

      - value – the value of the elements

      - l – the layout_type of the xoptional_assembly

  inline explicit xoptional_assembly(const shape_type &shape, const strides_type &strides)

    Allocates an uninitialized xoptional_assembly with the specified shape and strides.

    Parameters:

      - shape – the shape of the xoptional_assembly

      - strides – the strides of the xoptional_assembly

  inline explicit xoptional_assembly(const shape_type &shape, const strides_type &strides, const value_type &value)

    Allocates an uninitialized xoptional_assembly with the specified shape and strides.

    Elements are initialized to the specified value.

    Parameters:

      - shape – the shape of the xoptional_assembly

      - strides – the strides of the xoptional_assembly

      - value – the value of the elements

  inline xoptional_assembly(const VE &ve)

    Allocates an xoptional_assembly from the specified value expression.

    The flag expression is initialized as if no value is missing.

    Parameters:

      ve – the expression holding the values

  inline xoptional_assembly(VE &&ve)

    Allocates an xoptional_assembly from the specified value expression.

    The flag expression is initialized as if no value is missing. The value expression is moved inside the xoptional_assembly and is therefore not available after the xoptional_assembly has been constructed.

    Parameters:

      ve – the expression holding the values

  template<class OVE, class OFE, typename = std::enable_if_t<is_xexpression<OVE>::value && is_xexpression<OFE>::value>>
  inline xoptional_assembly(OVE &&ove, OFE &&ofe)

    Allocates an xoptional_assembly from the specified value expression and missing mask expression.

    Parameters:

      - ove – the expression holding the values

      - ofe – the expression holding the missing mask

  inline xoptional_assembly(const value_type &value)

    Allocates an xoptional_assembly that holds a single element initialized to the specified value.

    Parameters:

      value – the value of the element

  Constructors from initializer list

  inline xoptional_assembly(nested_initializer_list_t<value_type, 1> t)

    Allocates a one-dimensional xoptional_assembly.

    Parameters:

      t – the elements of the xoptional_assembly

  inline xoptional_assembly(nested_initializer_list_t<value_type, 2> t)

    Allocates a two-dimensional xoptional_assembly.

    Parameters:

      t – the elements of the xoptional_assembly

  inline xoptional_assembly(nested_initializer_list_t<value_type, 3> t)

    Allocates a three-dimensional xoptional_assembly.

    Parameters:

      t – the elements of the xoptional_assembly

  inline xoptional_assembly(nested_initializer_list_t<value_type, 4> t)

    Allocates a four-dimensional xoptional_assembly.

    Parameters:

      t – the elements of the xoptional_assembly

  inline xoptional_assembly(nested_initializer_list_t<value_type, 5> t)

    Allocates a five-dimensional xoptional_assembly.

    Parameters:

      t – the elements of the xoptional_assembly

  template<class S>
  inline xoptional_assembly<VE, FE> from_shape(S &&s)

    Allocates and returns an xoptional_assembly with the specified shape.

    Parameters:

      s – the shape of the xoptional_assembly

  Extended copy semantic

  template<class E>
  inline xoptional_assembly(const xexpression<E> &e)

    The extended copy constructor.

  template<class E>
  inline self_type &operator=(const xexpression<E> &e)

    The extended assignment operator.