Giter Site home page Giter Site logo

Comments (1)

DanRStevens avatar DanRStevens commented on June 13, 2024

This is very much by design. The typical case where I see this being used would be on const objects, where you can't use a mutator method. Modifying the method would make it impossible to use on such objects. For this case, it wouldn't be appropriate to provide const and mutable overloads, since that would make it very easy to modify an object by accident when you wanted a modified copy. You'd have to use const_cast or assign to const & variables to control which method was selected.

If we implement #704, it would be very easy to translate a Rectangle in-place without method support, since you'd have direct access to a Point object for the origin. I think that would be the better way to go about providing mutable translate support.

From an efficiency perspective, I doubt there is much difference either way. Rectangle is a fairly small and cheap object to create. I think the main concern here is usability and correctness, and that's going to depend on context.

from nas2d-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.