<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="color: rgb(33, 33, 33); font-size: 12pt;">>I suppose for a range algorithm (as opposed to a range adapter) you probably just need to take by T & (and T will be deduced to const U if needed).</span><br>
</p>
<p><br>
</p>
<p>Thanks David !<br>
</p>
<p><br>
</p>
<p>I would suggest to use next signature for <span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">parallelForEach in LLD then:</span><br>
</p>
<p><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">template <typename R, class FuncTy> void parallelForEach(const R &Range, FuncTy Fn) <br>
</span></p>
<p><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
<p><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">Because without `const` for `Range` next call would report warnings:</span></p>
<p><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">parallelForEach(std::vector<int>({ 1, 2 }), [](int) {});</span></p>
<div>warning C4239: nonstandard extension used: 'argument': conversion from 'std::vector<int,std::allocator<int>>' to 'std::vector<int,std::allocator<int>> &'</div>
<div>note: A non-const reference may only be bound to an lvalue.<br>
</div>
<div><br>
</div>
<div>I know we do not use such calls in LLD, but if one day LLVM's algorithms be changed from && to &,<br>
</div>
<div>I think it worth to use const fo them and therefore for LLD algorithms too.<br>
</div>
<div><br>
</div>
<div>George.<br>
</div>
<p><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
</body>
</html>