
From: David Abrahams <dave@boost-consulting.com>
Rob Stewart <stewart@sig.com> writes:
From: David Abrahams <dave@boost-consulting.com>
On the other hand\x{2014}as you may recall from the parameter table\x{2014}``color_map`` is an \x{201C}out\x{201D} parameter, so it really should be passed by non-const reference.
Note that "color_map" and "out" are quoted significantly differently with no apparent reason.
No, ``color_map`` isn't quotation; it's markup for "code font." Look at the HTML.
I was looking at it in the browser. I saw "``color_map``" and "<fancy open quote>out<fancy close quote>" so I saw no "code font" markup. Unless I'm misunderstanding you, something is wrong.
A keyword object has a pair of operator= overloads that ensure we can pass anything by name, but when an \x{201C}out\x{201D} parameter is passed positionally, that's no help: in this case, core::depth_first_search would end up with a const reference to the color_map and compilation will fail when mutating operations are used on it.
That's a long sentence and did you really mean to say "we can pass *anything*" (emphasis mine)?
Yep.
I didn't look, but it sounded odd that one could pass an int, char *, std::complex, etc.
Perhaps this would be better:
A keyword object has a pair of operator = overloads that ensure we can pass references to const or non-const objects by name,
You don't get to pass references to anything in C++. You pass the object referred to by a name or expression and the callee decides whether it goes by reference.
Yeah, I misspoke (miswrote?). I was referring to the parameter type when I should have been discussing the allowable argument types.
Also, the point is that you can pass both lvalues and rvalues, or temporaries and non-temporaries, not that the objects can be const or non-const. You can do that just fine with a single templated function taking a T& (T will be deduced as U const when the object is constant).
Pedantry aside, that's not the same as *anything*.
but when an "out" parameter is passed positionally, that's no help. In that case, core:;depth_first_search would end up with a...."
What about splitting the sentence into two? -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;