Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++17-like emplace.back() for arrays. #1609

Closed
TrueWodzu opened this issue May 23, 2019 · 7 comments
Closed

Add C++17-like emplace.back() for arrays. #1609

TrueWodzu opened this issue May 23, 2019 · 7 comments
Assignees
Labels
kind: enhancement/improvement release item: ✨ new feature solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Milestone

Comments

@TrueWodzu
Copy link

TrueWodzu commented May 23, 2019

Hi,

in C++17 there is a change in return value of std::vector::emplace_back(); Would it be possible to add this in library, so I could do something like this:

json json_obj;
json_obj["Type"] = 1;
json_obj["Version"] = 1;
json_obj["Documents"] = json::array();
auto document = json_obj["Documents"].emplace_back(); // Currently returns error.
@nlohmann
Copy link
Owner

That sounds doable!

@stale
Copy link

stale bot commented Jun 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Jun 23, 2019
@nlohmann nlohmann added good first issue and removed state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated labels Jun 24, 2019
@nlohmann nlohmann self-assigned this Jun 30, 2019
@nlohmann
Copy link
Owner

@TrueWodzu I extended emplace_back to return a reference (see 1be6343). Is this what you had in mind?

@TrueWodzu
Copy link
Author

Yes, exactly. Thank you :)

@nlohmann nlohmann reopened this Jun 30, 2019
@nlohmann
Copy link
Owner

I reopened the issue, because the change has not yet been merged to the develop branch.

@TrueWodzu
Copy link
Author

That's fine, you the boss ;)

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Jul 2, 2019
@nlohmann
Copy link
Owner

nlohmann commented Jul 9, 2019


🔖 Release item

This issue/PR will be part of the next release of the library. This template helps preparing the release notes.

Type

  • ✨ New Feature
  • 🐛 Bug Fix
  • ⚡️ Improvement
  • 🔨 Further Change
  • 🔥 Deprecated function

Description


@nlohmann nlohmann added this to the Release 3.6.2 milestone Jul 9, 2019
@nlohmann nlohmann closed this as completed Jul 9, 2019
@nlohmann nlohmann modified the milestones: Release 3.6.2, Release 3.7.0 Jul 9, 2019
@nlohmann nlohmann added this to the Release 3.7.0 milestone Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement/improvement release item: ✨ new feature solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants