Skip to content

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

Closed

Description

@louwers

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.

Activity

  1. added
    state: please discuss
    on Dec 24, 2016
  2. nlohmann commented on Dec 24, 2016

    @nlohmann
    Owner

    The syntax was borrowed from Python.

  3. nlohmann commented on Jan 2, 2017

    @nlohmann
    Owner

    Any other opinions on this?

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

    state: please discuss

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions