38. Boost package for array manipulation

The array_boost module implements collection of array manipulation routines.

All functions and symbols are in “array_boost” module, use require to get access to it.

require daslib/array_boost

38.1. Temporary arrays

temp_array(arr: auto implicit ==const) : auto()

Warning

This is unsafe operation.

Creates temporary array from the given object. Important requirements are:

  • object memory is linear

  • each element follows the next one directly, with the stride equal to size of the element

  • object memory does not change within the lifetime of the returned array

Arguments
  • arr : auto implicit!

temp_array(arr: auto const implicit ==const) : auto()

Warning

This is unsafe operation.

Creates temporary array from the given object. Important requirements are:

  • object memory is linear

  • each element follows the next one directly, with the stride equal to size of the element

  • object memory does not change within the lifetime of the returned array

Arguments
  • arr : auto implicit!

temp_array(data: auto? ==const; lenA: int; a: auto(TT)) : array<TT>()

Warning

This is unsafe operation.

creates a temporary array from the given data pointer and length Important requirements are:

  • data pointer is valid and points to a memory block of at least lenA elements

  • each element follows the next one directly, with the stride equal to size of the element

  • data memory does not change within the lifetime of the returned array

Arguments
  • data : auto?!

  • lenA : int

  • a : auto(TT)

temp_array(data: auto? ==const; lenA: int; a: auto(TT)) : array<TT>()

Warning

This is unsafe operation.

creates a temporary array from the given data pointer and length Important requirements are:

  • data pointer is valid and points to a memory block of at least lenA elements

  • each element follows the next one directly, with the stride equal to size of the element

  • data memory does not change within the lifetime of the returned array

Arguments
  • data : auto?!

  • lenA : int

  • a : auto(TT)

38.2. Empty check

empty(v: auto(VecT)) : auto()

returns true if ‘v’ has 0 elements. this also implies that length(v) is defined.

Arguments
  • v : auto(VecT)

38.3. Sub-array view

array_view(bytes: array<auto(TT)>; offset: int; length: int; blk: block<(view:array<TT>#):void>) : auto()

creates a view of the array, which is a temporary array that is valid only within the block

Arguments
  • bytes : array<auto(TT)>!

  • offset : int

  • length : int

  • blk : block<(view:array<TT>#):void>

array_view(bytes: array<auto(TT)>; offset: int; length: int; blk: block<(var view:array<TT>#):void>) : auto()

creates a view of the array, which is a temporary array that is valid only within the block

Arguments
  • bytes : array<auto(TT)>!

  • offset : int

  • length : int

  • blk : block<(view:array<TT>#):void>