+ @code{.unparsed}
+ --five-guys --burger-king --pizza-hut --subway
+ @endcode
+
+ <li>
+ Long options with arguments (two original arguments or a single
+ one with a <code>=</code> character):
+
+ @code{.unparsed}
+ --security enable --time=18.56
+ @endcode
+
+ <li>
+ Non-option arguments (anything else, including
+ <code>-</code> and <code>\--</code>).
+
+ A non-option argument cannot have the form of an option, for example
+ if you need to pass the exact relative path
+ <code>\--component</code>. In that case, you would need to pass
+ <code>./\--component</code>. There's no generic way to escape
+ <code>-</code> as of this version.
+</ul>
+
+Create a parsing iterator with argpar_iter_create(), then repeatedly
+call argpar_iter_next() to access the parsing results (items), until one
+of:
+
+- There are no more arguments.
+
+- The argument parser encounters an error (for example, an unknown
+ option).
+
+- You need to stop.
+
+argpar_iter_create() accepts duplicate option descriptors in
+\p descrs (argpar_iter_next() produces one item for each
+instance).
+
+A parsing item (the result of argpar_iter_next()) has the type
+#argpar_item.
+
+Get the type (option or non-option) of an item with
+\link argpar_item_type(const argpar_item_t *) argpar_item_type()\endlink.
+Each item type has its set of dedicated functions
+(\c argpar_item_opt_ and \c argpar_item_non_opt_ prefixes).
+
+argpar_iter_next() produces the items in the same order that it parses
+original arguments, including non-option arguments. This means, for
+example, that for:
+
+@code{.unparsed}
+--hello --count=23 /path/to/file -ab --type file -- magie
+@endcode
+
+argpar_iter_next() produces the following items, in this order:
+
+-# Option item: <code>\--hello</code>.
+-# Option item: <code>\--count</code> with argument <code>23</code>.
+-# Non-option item: <code>/path/to/file</code>.
+-# Option item: <code>-a</code>.
+-# Option item: <code>-b</code>.
+-# Option item: <code>\--type</code> with argument <code>file</code>.
+-# Non-option item: <code>\--</code>.
+-# Non-option item: <code>magie</code>.
+*/
+
+/* Internal: `noexcept` specifier if C++ ≥ 11 */
+#if defined(__cplusplus) && (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900))
+# define ARGPAR_NOEXCEPT noexcept
+#else
+# define ARGPAR_NOEXCEPT
+#endif
+
+typedef struct argpar_opt_descr argpar_opt_descr_t;
+
+/*!
+@name Item API
+@{
+*/
+
+/*!
+@brief
+ Type of a parsing item, as returned by
+ \link argpar_item_type(const argpar_item *) argpar_item_type()\endlink.
+*/
+typedef enum argpar_item_type
+{
+ /// Option
+ ARGPAR_ITEM_TYPE_OPT,
+
+ /// Non-option
+ ARGPAR_ITEM_TYPE_NON_OPT,
+} argpar_item_type_t;
+
+/*!
+@struct argpar_item
+
+@brief
+ Opaque parsing item type
+
+argpar_iter_next() sets a pointer to such a type.
+*/
+typedef struct argpar_item argpar_item_t;
+
+/*!
+@brief
+ Returns the type of the parsing item \p item.
+
+@param[in] item
+ Parsing item of which to get the type.
+
+@returns
+ Type of \p item.
+
+@pre
+ \p item is not \c NULL.
+*/
+argpar_item_type_t argpar_item_type(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the option descriptor of the option parsing item \p item.
+
+@param[in] item
+ Option parsing item of which to get the option descriptor.
+
+@returns
+ Option descriptor of \p item.
+
+@pre
+ \p item is not \c NULL.
+@pre
+ \p item has the type #ARGPAR_ITEM_TYPE_OPT.
+*/
+const argpar_opt_descr_t *argpar_item_opt_descr(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the argument of the option parsing item \p item, or
+ \c NULL if none.
+
+@param[in] item
+ Option parsing item of which to get the argument.
+
+@returns
+ Argument of \p item, or \c NULL if none.
+
+@pre
+ \p item is not \c NULL.
+@pre
+ \p item has the type #ARGPAR_ITEM_TYPE_OPT.
+*/
+const char *argpar_item_opt_arg(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the complete original argument, pointing to one of the
+ entries of the original arguments (in \p argv, as passed to
+ argpar_iter_create()), of the non-option parsing item \p item.
+
+@param[in] item
+ Non-option parsing item of which to get the complete original
+ argument.
+
+@returns
+ Complete original argument of \p item.
+
+@pre
+ \p item is not \c NULL.
+@pre
+ \p item has the type #ARGPAR_ITEM_TYPE_NON_OPT.
+*/
+const char *argpar_item_non_opt_arg(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the index, within \em all the original arguments (in
+ \p argv, as passed to argpar_iter_create()), of the non-option
+ parsing item \p item.
+
+For example, with the following command line (all options have no
+argument):
+
+@code{.unparsed}
+-f -m meow --jus mix --kilo
+@endcode
+
+The original argument index of \c meow is 2 while the original
+argument index of \c mix is 4.
+
+@param[in] item
+ Non-option parsing item of which to get the original argument index.
+
+@returns
+ Original argument index of \p item.
+
+@pre
+ \p item is not \c NULL.
+@pre
+ \p item has the type #ARGPAR_ITEM_TYPE_NON_OPT.
+
+@sa
+ argpar_item_non_opt_non_opt_index() -- Returns the non-option index
+ of a non-option parsing item.
+*/
+unsigned int argpar_item_non_opt_orig_index(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the index, within the parsed non-option parsing items, of
+ the non-option parsing item \p item.
+
+For example, with the following command line (all options have no
+argument):
+
+@code{.unparsed}
+-f -m meow --jus mix --kilo
+@endcode
+
+The non-option index of \c meow is 0 while the original
+argument index of \c mix is 1.
+
+@param[in] item
+ Non-option parsing item of which to get the non-option index.
+
+@returns
+ Non-option index of \p item.
+
+@pre
+ \p item is not \c NULL.
+@pre
+ \p item has the type #ARGPAR_ITEM_TYPE_NON_OPT.
+
+@sa
+ argpar_item_non_opt_orig_index() -- Returns the original argument
+ index of a non-option parsing item.
+*/
+unsigned int argpar_item_non_opt_non_opt_index(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Destroys the parsing item \p item.
+
+@param[in] item
+ Parsing item to destroy (may be \c NULL).
+*/
+void argpar_item_destroy(const argpar_item_t *item) ARGPAR_NOEXCEPT;
+
+/*!
+@def ARGPAR_ITEM_DESTROY_AND_RESET(_item)
+
+@brief
+ Calls argpar_item_destroy() with \p _item, and then sets \p _item
+ to \c NULL.
+
+@param[in] _item
+ Item to destroy and variable to reset
+ (<code>const argpar_item_t *</code> type).
+*/
+#define ARGPAR_ITEM_DESTROY_AND_RESET(_item) \
+ { \
+ argpar_item_destroy(_item); \
+ (_item) = NULL; \
+ }
+
+/// @}
+
+/*!
+@name Error API
+@{
+*/
+
+/*!
+@brief
+ Parsing error type, as returned by
+ \link argpar_error_type(const argpar_error_t *) argpar_error_type()\endlink.
+*/
+typedef enum argpar_error_type
+{
+ /// Unknown option error
+ ARGPAR_ERROR_TYPE_UNKNOWN_OPT,