opAssign and const?

Era Scarecrow rtcvb32 at yahoo.com
Mon May 7 13:39:54 PDT 2012


>> On Saturday, May 05, 2012 05:50:26 Era Scarecrow wrote:
>>> Hmm maybe it should have a preference for Lvalue vs Rvalue... 
>>> So... Walter or Andrei?
>>> 
>>>  1. no match
>>>  2. match with im­plicit con­ver­sions (Lvalue required)
>>>  3. match with con­ver­sion to const (Lvalue required)
>>>  4. match with im­plicit con­ver­sions
>>>  5. match with con­ver­sion to const
>>>  6. exact match

  Thinking about this, perhaps it should attempt the following 
order instead.

  (Not sure of the no match here)
  2. match with con­ver­sion to const (Lvalue required)
  3. match with im­plicit con­ver­sions (Lvalue required)
  4. match with con­ver­sion to const
  5. match with im­plicit con­ver­sions
  6. exact match
  7. no match - Templates attempted
  8. error?

  Trying the more restrictive ones first. You can convert mutable 
to const, but you can't turn it around without specific cast and 
knowledge. If you think about it too, very little code will 
likely be const, or ones that are const usually will be by 
themselves so ordering isn't going to be as important.


More information about the Digitalmars-d mailing list