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

Overloaded += to add objects to an array makes no sense? #404

Closed
louwers opened this issue Dec 24, 2016 · 2 comments
Closed

Overloaded += to add objects to an array makes no sense? #404

louwers opened this issue Dec 24, 2016 · 2 comments
Labels
state: please discuss please discuss the issue or vote for your favorite option

Comments

@louwers
Copy link

louwers commented Dec 24, 2016

Hello there!

I was wondering why += was overloaded to add an item to an array. a += b should always be the same as a = a + b in my opinion, but of course + isn't overloaded because that would not make any sense (as everyone rightfully expects both operands to be the same type when using +).

I'd like to hear your thoughts on this.

@nlohmann nlohmann added the state: please discuss please discuss the issue or vote for your favorite option label Dec 24, 2016
@nlohmann
Copy link
Owner

The syntax was borrowed from Python.

@nlohmann
Copy link
Owner

nlohmann commented Jan 2, 2017

Any other opinions on this?

@nlohmann nlohmann closed this as completed Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: please discuss please discuss the issue or vote for your favorite option
Projects
None yet
Development

No branches or pull requests

2 participants