/** * Replaces the last returned element pair by <code>deque_zip_iter_next()</code> * with the specified replacement element pair. * * @param[in] iter Iterator on which this operation is being performed * @param[in] e1 First deque's replacement element * @param[in] e2 Second deque's replacement element * @param[out] out1 Output of the replaced element from the first deque * @param[out] out2 Output of the replaced element from the second deque * * @return CC_OK if the element was successfully replaced, or CC_ERR_OUT_OF_RANGE. */ enum cc_stat deque_zip_iter_replace(DequeZipIter *iter, void *e1, void *e2, void **out1, void **out2) { if ((iter->index - 1) >= iter->d1->size || (iter->index - 1) >= iter->d2->size) return CC_ERR_OUT_OF_RANGE; deque_replace_at(iter->d1, e1, iter->index - 1, out1); deque_replace_at(iter->d2, e2, iter->index - 1, out2); return CC_OK; }
/** * Replaces the last returned element by <code>deque_iter_next()</code> * with the specified element and optionally sets the out parameter to * the value of the replaced element. * * @note This function should only ever be called after a call to <code> * deque_iter_next()</code> * * @param[in] iter the iterator on which this operation is being performed * @param[in] element the replacement element * @param[out] out Pointer to where the replaced element is stored, or NULL * if it is to be ignored * * @return CC_OK if the element was replaced successfully, or * CC_ERR_VALUE_NOT_FOUND. */ enum cc_stat deque_iter_replace(DequeIter *iter, void *replacement, void **out) { return deque_replace_at(iter->deque, replacement, iter->index, out); }
/** * Replaces the last returned element by <code>deque_iter_next()</code> * with the specified replacement element. * * @param[in] iter the iterator on which this operation is being performed * @param[in] replacement the replacement element * * @return the old element that was replaced */ void *deque_iter_replace(DequeIter *iter, void *replacement) { return deque_replace_at(iter->deque, replacement, iter->index); }