+
+#define array_append(array, objs, Len) \
+ do { \
+ const typeof((array).len) __len = (Len); \
+ array_ensure_capacity_delta(array, __len); \
+ memcpy((array).data + (array).len, objs, \
+ __len * sizeof(*(array).data)); \
+ (array).len += __len; \
+ } while (0)
+
+
+/******* ACCESSSING ELEMENTS ********/
+
+/** Getting the n'th element of the array.
+ */
+#define array_elt(array, n) ((array).data[(n)])
+
+#define array_first(array) array_elt(array, 0)
+#define array_last(array) array_elt(array, (array).len - 1)
+
+#define array_pop_last(array) array_elt(array, --((array).len))
+
+/** Getting a pointer to the n'th element of the array.
+ */
+#define array_ptr(array, n) ((array).data + (n))
+
+#define array_start(array) array_ptr((array), 0)
+#define array_end(array) array_ptr((array), array_len(array))
+
+/****** TRAVERSING AN ARRAY *******/
+
+/** Gives the position of pointer ptr in the array.
+ * This macro may only be used withing a loop. @ref foreach.
+ */
+#define array_pos(array, ptr) ((ptr) - array_start(array))
+
+/** Build a loop over the elements of an array.
+ *
+ * <code>
+ * A(MyType) array;
+ * ...
+ * foreach (MyType* element, array) {
+ * do_something(element);
+ * }}
+ * </code>
+ *
+ * Warnings:
+ * * remember the loop must be ended with }} (the foreach macro contains
+ * a not-matched opening brace).
+ * * the macro uses a counter name __Ai, so you cannot build imbricated
+ * array enumerations. You SHOULD NOT use this counter in your code since
+ * it is part of the internal API and may change in the future.
+ */