The change also fixes a rare bug introduced in 9007958:
when there are duplicated keys, insert_or_update overrides
previously inserted ones, emplace doesn't.
fixes: p-ranav/argparse#59
This change also explicitly lists the source files
for CMake. This is because `GLOB` does not remove
old files when switching branches in Git, and
`CONFIGURE_DEPENDS` will add unstaged files after
stashing.
See also: https://cmake.org/cmake/help/latest/command/file.html#glob
Before this change:
1. When the input is built-in string literal or cv-`char*`,
`is_optional` constructs temporary `std::string` while
`mNames` initializer is also constructing `std::string`
due to the use of `std::initializer_list`.
2. When the input is `std::string_view`, doesn't compile.
3. When the input is `std::string`, `mNames` initializer
moves `args`. If argument name is longer than
`std::string`'s SSO buffer, bad thing will happen because
`is_optional` will be accessing `args` in moved-from
states.
Because of the use of `strtol` which expects nul-terminated
input, `is_*` series functions must take `std::string`. This
restriction may be removed after AppleClang adds `<charconv>`.
But for now, it complicates the patch. My solution is to
create an array prvalue still, but use a array reference
rather than `std::initializer_list` to refer to it, so that
the code in delegated constructor can keep using fold
expressions after the necessary `std::string` objects being
created.