opAssign and const?
Era Scarecrow
rtcvb32 at yahoo.com
Fri May 4 22:06:03 PDT 2012
On Saturday, 5 May 2012 at 04:15:21 UTC, Jonathan M Davis wrote:
> This will likely be _very_ relevant to the proposed changes
> which make ref and const ref work with rvalues (the details on
> that are still being sorted out, I believe). However, I don't
> believe that either Walter or Andrei pays attention to
> D.Learn, so if you want to bring it up for discussion, post
> about it in the main newsgroup (not to mention, your post is
> buried enough in this thread that many who _do_ pay attention
> to D.Learn wouldn't see it).
TDPL pg. 145
1) If there's one exact match, take that
2) Select a set of candidates that would accept the call if no
other overloads are present. Here is where type deductions
deduces types and if clauses are evaluated.
3) If the set has size zero, issue "no match" error.
4) If all functions are not in the same module, issue "attempt at
cross-module overloading" error.
5) From that set eliminate all functions that are less
specialized than any others in the set; that is, keep only the
most specialized functions.
6) If the remaining set has size greater than one, issue
"ambiguous call" error
7) The sole element of the set is the winner.
void transmogrify(uint){}
void transmogrify(long){}
... the first is more specialized so it is entitled to win.
--
I get the feeling the 'ref' in our current discussion isn't
being considered as how specialized it is (step 5). Maybe, but
it's something to comment on. We'll see what Walter/Andrei have
to say. my proposed Lvalue required steps are likely a better
help than the rest of this though.
More information about the Digitalmars-d-learn
mailing list