Lines Matching defs:list

37 bool is_empty(List<T> const &list);
40 typename List<T>::reference first(List<T> const &list);
43 List<T> const &rest(List<T> const &list);
46 MutableList<T> &rest(MutableList<T> const &list);
49 MutableList<T> const &set_rest(MutableList<T> const &list,
98 * Generic linked list.
113 * If you need to create an empty list (which can, for example, be used
197 * Like a linked list, but one whose tail can be exchanged for
201 * As with List, you can create an empty list like so:
229 * Creates a (non-empty) linked list.
231 * Creates a new linked list with a copy of the given value (\a first)
232 * in its first element; the remainder of the list will be the list
235 * The remainder of the list -- the "tail" -- is incorporated by
240 * @param first the value for the first element of the list
241 * @param rest the rest of the list; may be an empty list
243 * @return a new list
257 * Creates a (non-empty) linked list whose tail can be exchanged
260 * Creates a new linked list, but one whose tail can be exchanged for
267 * As with List<>, you can create an empty list like so:
274 * @param first the value for the first element of the list
275 * @param rest the rest of the list; may be an empty list
277 * @return a new list
287 * Returns true if the given list is empty.
289 * Returns true if the given list is empty. This is equivalent
290 * to !list.
292 * @param list the list
294 * @return true if the list is empty, false otherwise.
297 inline bool is_empty(List<T> const &list) { return !list._cell; }
300 * Returns the first value in a linked list.
302 * Returns a reference to the first value in the list. This
305 * If the list holds mutable values (or references to them), first()
310 * first(list) = value;
312 * The results of calling this on an empty list are undefined.
317 * @param list the list; cannot be empty
319 * @return a reference to the first value in the list
322 inline typename List<T>::reference first(List<T> const &list) {
323 return list._cell->value;
327 * Returns the remainder of a linked list after the first element.
329 * Returns the remainder of the list after the first element (its "tail").
333 * The results of calling this on an empty list are undefined.
338 * @param list the list; cannot be empty
340 * @return the remainder of the list
343 inline List<T> const &rest(List<T> const &list) {
344 return reinterpret_cast<List<T> const &>(list._cell->next);
348 * Returns a reference to the remainder of a linked list after
351 * Returns a reference to the remainder of the list after the first
357 * rest(list) = other;
359 * Results of calling this on an empty list are undefined.
364 * @param list the list; cannot be empty
366 * @return a reference to the remainder of the list
369 inline MutableList<T> &rest(MutableList<T> const &list) {
370 return reinterpret_cast<MutableList<T> &>(list._cell->next);
374 * Sets a new tail for an existing linked list.
379 * Results of calling this on an empty list are undefined.
385 * @param list the list; cannot be empty
391 inline MutableList<T> const &set_rest(MutableList<T> const &list,
394 list._cell->next = rest._cell;
395 return reinterpret_cast<MutableList<T> &>(list._cell->next);