Inventory.opBinary

Concatenates two inventories (or an inventory and an array of slots) and returns a new one.

  1. Inventory opBinary(Slot[] slots)
    class Inventory
    @safe
    opBinary
    (
    string op
    )
    if (
    op == "~"
    )
  2. Inventory opBinary(Inventory inventory)
  3. Inventory opBinary(Slot slot)
  4. Slot* opBinary(T item)

Examples

auto inventory = new Inventory(4);
auto ni = inventory ~ [Slot(null), Slot(null)] ~ inventory;
assert(inventory.length == 4);
assert(ni.length == 10);

Meta