Skip to content

No structured bindings support? #901

Description

Bug Report

  • What is the issue you have?
    Cannot use C++17 structured bindings for iteration

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

Although this DOES work (taken from the docs):

for (json::iterator it = o.begin(); it != o.end(); ++it) {
  std::cout << it.key() << " : " << it.value() << "\n";
}

The following DOES NOT work:

for (auto&& [k,v] : o)
  std::cout << k << ":" << v << "\n";
  • What is the expected behavior?
    It should do the same thing as the traditional iterator implementation

  • And what is the actual behavior instead?
    Does not compile

  • Which compiler and operating system are you using? Is it a supported compiler?
    clang++ 6.0 (svn tree)

  • Did you use a released version of the library or the version from the develop branch?
    Yes, 3.0.1

  • If you experience a compilation error: can you compile and run the unit tests?

The tests work fine, so no issues there

Feature Request

  • Describe the feature in as much detail as possible.

  • Include sample usage where appropriate.

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

    solution: proposed fixa fix for the issue has been proposed and waits for confirmation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions