Commit e9d20c2c078076da928288fdbae2a39431b4f253
Committed by
GitHub
1 parent
1dcb44e7
Remove deprecated iterator type (#381)
Fixes #379. `iterator` is deprecated in C++17.
Showing
2 changed files
with
8 additions
and
3 deletions
include/cxxopts.hpp
| ... | ... | @@ -143,11 +143,16 @@ toLocalString(std::string s) |
| 143 | 143 | CXXOPTS_DIAGNOSTIC_PUSH |
| 144 | 144 | CXXOPTS_IGNORE_WARNING("-Wnon-virtual-dtor") |
| 145 | 145 | // This will be ignored under other compilers like LLVM clang. |
| 146 | -class UnicodeStringIterator : public | |
| 147 | - std::iterator<std::forward_iterator_tag, int32_t> | |
| 146 | +class UnicodeStringIterator | |
| 148 | 147 | { |
| 149 | 148 | public: |
| 150 | 149 | |
| 150 | + using iterator_category = std::forward_iterator_tag; | |
| 151 | + using value_type = int32_t; | |
| 152 | + using difference_type = std::ptrdiff_t; | |
| 153 | + using pointer = value_type*; | |
| 154 | + using reference = value_type&; | |
| 155 | + | |
| 151 | 156 | UnicodeStringIterator(const icu::UnicodeString* string, int32_t pos) |
| 152 | 157 | : s(string) |
| 153 | 158 | , i(pos) | ... | ... |
src/example.cpp
| ... | ... | @@ -62,7 +62,7 @@ parse(int argc, const char* argv[]) |
| 62 | 62 | ("tab-expansion", "Tab\texpansion") |
| 63 | 63 | ("int", "An integer", cxxopts::value<int>(), "N") |
| 64 | 64 | ("float", "A floating point number", cxxopts::value<float>()) |
| 65 | - ("vector", "A list of doubles", cxxopts::value<std::vector<double>>()) | |
| 65 | + ("vector", "A list of doubles", cxxopts::value<std::vector<double>>()->default_value("")) | |
| 66 | 66 | ("option_that_is_too_long_for_the_help", "A very long option") |
| 67 | 67 | ("l,list", "List all parsed arguments (including default values)") |
| 68 | 68 | ("range", "Use range-for to list arguments") | ... | ... |