| 787 | |
| 788 | template <typename IndexType> |
| 789 | bool GetNumericArgument(std::string const& arg, IndexType& value) |
| 790 | { |
| 791 | try { |
| 792 | std::size_t pos; |
| 793 | |
| 794 | if (sizeof(IndexType) == sizeof(long)) { |
| 795 | value = std::stol(arg, &pos); |
| 796 | } else { |
| 797 | value = std::stoll(arg, &pos); |
| 798 | } |
| 799 | |
| 800 | if (pos != arg.length()) { |
| 801 | // this is not a number |
| 802 | return false; |
| 803 | } |
| 804 | } catch (std::invalid_argument const&) { |
| 805 | return false; |
| 806 | } |
| 807 | |
| 808 | return true; |
| 809 | } |
| 810 | |
| 811 | template <typename IndexType> |
| 812 | bool GetNumericArguments( |
no test coverage detected
searching dependent graphs…