Giter VIP home page Giter VIP logo

Comments (2)

louis-langholtz avatar louis-langholtz commented on May 19, 2024

I believe dropping the field accessors in favor of real array composition will also facilitate use of SSE and other parallel processing capabilities. But if this change is going to happen, it needs to happen IMO before launch so less users had to rewrite their code from using .x and .y to using [0] and [1].

from playrho.

louis-langholtz avatar louis-langholtz commented on May 19, 2024

This is done now and passes all builds/tests as of commit aad9ebb.

So no more access to Vec2 or Length2D etc via .x or .y.

If a programmer wants to access elements by horizontal or vertical concepts, the template functions GetX and GetY are there now for that. If a programmer wants to access elements by array concepts, the template functions std::get<0> and std::get<1> are there now for this (and implemented for the base Vector template structure). These are all compile-time safe too in that their setup is such that the compiler should output an error if you were to try and do something like access element 4 via code like std::get<4>. I think these should be the recommended ways to access the Vector based types.

Alternatively, the Vector based types can all be accessed like arrays; with subscripts. Like: location[0] or location[1]. Out-of-bounds access as arrays is not guaranteed to be caught by the compiler however.

from playrho.

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.