Remove deprecated iterator type (#381)

Fixes #379. `iterator` is deprecated in C++17.
This commit is contained in:
jarro2783 2022-12-05 07:40:46 +11:00 committed by GitHub
parent 1dcb44e79a
commit e9d20c2c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -143,11 +143,16 @@ toLocalString(std::string s)
CXXOPTS_DIAGNOSTIC_PUSH
CXXOPTS_IGNORE_WARNING("-Wnon-virtual-dtor")
// This will be ignored under other compilers like LLVM clang.
class UnicodeStringIterator : public
std::iterator<std::forward_iterator_tag, int32_t>
class UnicodeStringIterator
{
public:
using iterator_category = std::forward_iterator_tag;
using value_type = int32_t;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
UnicodeStringIterator(const icu::UnicodeString* string, int32_t pos)
: s(string)
, i(pos)

View File

@ -62,7 +62,7 @@ parse(int argc, const char* argv[])
("tab-expansion", "Tab\texpansion")
("int", "An integer", cxxopts::value<int>(), "N")
("float", "A floating point number", cxxopts::value<float>())
("vector", "A list of doubles", cxxopts::value<std::vector<double>>())
("vector", "A list of doubles", cxxopts::value<std::vector<double>>()->default_value(""))
("option_that_is_too_long_for_the_help", "A very long option")
("l,list", "List all parsed arguments (including default values)")
("range", "Use range-for to list arguments")