Skip to content

is_array() is True, but raise 'cannot use operator[] for object iterators' #1880

Description

@estelll
  • Describe what you want to achieve.
    There are two array A, B in the same size. In python I can use zip(A, B) to get elements from them at the same time. But I am not sure how to get it using this cpp.

  • Describe what you tried.
    I first get the array size by 'A.size()', then I iterate the index from 0 to the size. And using A[idx] and B[idx] to get elements separately.
    However, it raise

 terminate called after throwing an instance of 'nlohmann::detail::invalid_iterator'
  what():  [json.exception.invalid_iterator.208] cannot use operator[] for object iterators

And I am sure A and B is an array instead of object since I A.is_array() is True and B.is_array() is True too

  • Describe which system (OS, compiler) you are using.
    LInux

  • Describe which version of the library you are using (release version, develop branch).
    develop branch, 3.7.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: questionstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions