Comments (4)
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.
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.
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.
@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)
- TextPatternRange.GetText() UIAutomation throws AccessViolationException on Windows 11
- When using pattern it works normally in windows 10 but failing in window 11. HOT 1
- Give more meaningful error in UiaOperationAbstraction when MalformedBytecode is returned from the operation
- UiaArray should have a convenience `Contains` API which internally just does a local/remote for loop.
- UiaArray should have a constructor which takes a begin iterator and an end iterator
- Get UiaOperationAbstraction `TryCatch` working inside loops and with `UiaOperationDelegator::AbortOperationWithHresult` HOT 1
- Update tests and comments once a Windows version which can fail IsOpcodeSupported is released
- UiaString get() method returns the internal data member as a raw BSTR making it easy to mis-use ownership
- CoreAutomationRemoteOperation HOT 3
- IsOffscreen has wrong value. HOT 1
- Add automated tests for custom extensions
- Produce a more meaningful error code on `AutomationRemoteOperationStatus::InstructionLimitExceeded` HOT 5
- Replace implicit conversions in UiaOperationAbstraction with explicit ones HOT 2
- Impossible to build the library on Windows 7 HOT 3
- Make UiaEmpty, UIaByteArray, Support Call Extension on UiaElement, UiaTextRange, Implement new UiaConnectionBoundObject
- Custom patterns are impossible in c# HOT 1
- TreeWalker issue in Microsoft Office Picture Manager
- [Windows 11] Some methods of UI Automation can not work in windows 11 HOT 3
- UI Automation is not work in windows 11 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft-ui-uiautomation.