class AutoC::Range::ForwardRange::BidirectionalRange

@abstract

Private Instance Methods

configure() click to toggle source
Calls superclass method AutoC::Range::ForwardRange#configure
# File lib/autoc/ranges.rb, line 233
def configure
  super
  method(:void, :pop_back, { range: rvalue }).configure do
    header %{
      @brief Rewind back position to the previous existing element

      @param[in] range range to rewind back position for

      This function is used to get to the previous element in the range.

      @note Prior calling this function one must ensure that the range is not empty (see @ref #{type.empty}).
      Rewinding position of a range that is already empty results in undefined behaviour.

      @since 2.0
    }
  end
  method(iterable.element.const_lvalue, :view_back, { range: const_rvalue }).configure do
    header %{
      @brief Get a view of the back element

      @param[in] range range to retrieve element from
      @return a view of an element at the range's back position

      This function is used to get a constant reference (in form of the C pointer) to the value contained in the iterable container at the range's back position.
      Refer to @ref #{type.take_back} to get an independent copy of that element.
  
      It is generally not safe to bypass the constness and to alter the value in place (although no one prevents to).
  
      @note Range must not be empty (see @ref #{type.empty}).

      @since 2.0
    }
  end
  method(iterable.element, :take_back, { range: const_rvalue }, constraint:-> { iterable.element.copyable? }).configure do
    dependencies << empty << view_back
    inline_code %{
      #{iterable.element} result;
      #{iterable.element.const_lvalue} e;
      assert(!#{empty.(range)});
      e = #{view_back.(range)};
      #{iterable.element.copy.(:result, '*e')};
      return result;
    }
    header %{
      @brief Get a copy of the back element

      @param[in] range range to retrieve element from
      @return a *copy* of element at the range's back position

      This function is used to get a *copy* of the value contained in the iterable container at the range's front position.
      Refer to @ref #{type.view_back} to get a view of the element without making an independent copy.

      This function requires the element type to be *copyable* (i.e. to have a well-defined copy operation).

      @note Range must not be empty (see @ref #{type.empty}).

      @since 2.0
    }
  end
end