GithubHelp home page GithubHelp logo

Comments (4)

michaelDCurran avatar michaelDCurran commented on May 21, 2024

the change would be as follows:

diff --git a/src/UIAutomation/UiaOperationAbstraction/UiaOperationAbstraction.h b/src/UIAutomation/UiaOperationAbstraction/UiaOperationAbstraction.h
index eb831d4..86c843d 100644
--- a/src/UIAutomation/UiaOperationAbstraction/UiaOperationAbstraction.h
+++ b/src/UIAutomation/UiaOperationAbstraction/UiaOperationAbstraction.h
@@ -2375,7 +2375,7 @@ namespace UiaOperationAbstraction
                 [&]() { index += 1; } /* modification */,
                 [&]() /* body */
                 {
-                    const auto element = array.GetAt(index);
+                    auto element = array.GetAt(index);
                     body(element);
                 });
         }

from microsoft-ui-uiautomation.

michaelDCurran avatar michaelDCurran commented on May 21, 2024

I'm also happy to accept an answer such that it is recommended that all Uia* types should always be accepted by value in functions, but in this case I'd appreciate a clear explanation as to why.

from microsoft-ui-uiautomation.

beweedon avatar beweedon commented on May 21, 2024

Hmm, thanks for the feedback! Honestly, my guess as to why we made that const is just that we're getting the array item by value from GetAt and didn't think too hard about what the signature of body would be.

I think I agree with you that it shouldn't be const. That way we allow body to have whatever signature it wants, which matches the capabilities of normal C++ foreach loops (i.e. the item can be const auto, const auto&, auto& etc.).

@pengyuanjin @mavangur @zhayuli Do you have any particular thoughts on this?

from microsoft-ui-uiautomation.

beweedon avatar beweedon commented on May 21, 2024

@michaelDCurran I'd say go ahead and put up a PR for this if you want (along with some tests validating multiple constness-es). Otherwise we'll get to it when we have the chance.

from microsoft-ui-uiautomation.

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.