Opened 13 years ago
Closed 12 years ago
#8643 closed bug (fixed)
AVLTreeMap strategy Auto discards const
Reported by: | pdziepak | Owned by: | axeld |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | System/Kernel | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Member functions CompareKeyNode
and CompareNodes
of AVLTreeMapStrategy::Auto
attempt to implicitly discard const qualifier.
Attachments (1)
Change History (8)
comment:1 by , 13 years ago
patch: | 0 → 1 |
---|
comment:2 by , 13 years ago
comment:3 by , 13 years ago
This patch fixes that particular problem in probably the best way. However, it looks like there are still const correctness problems (or at least const_cast
s worth removing) in AVLTreeMap implementation. At least, now, everything that NFSv4 client needs from it works correctly.
comment:4 by , 13 years ago
Thanks for the update, Pawel. In the NodeStrategy comment, the const
in the return value of GetKey()
is superfluous, since it isn't a reference. Please note that the return value isn't a reference by intent, since in some cases the key isn't stored as a sub-object in the node object, but has to be computed (if it can, the node strategy is allowed to return a const reference though, since that is assignment compatible).
I also wonder why the GetKey()
version with a non-const Node*
parameter would be needed at all. I would say a const version would suffice.
And finally I don't think the new GetValue()
version is ever called. AFAICT the only caller is AVLTreeMap::_GetValue(Node* node)
, which has a non-const node anyway.
by , 12 years ago
Attachment: | 0001-Fix-8643-AVLTreeMap-strategy-Auto-discards-const.patch added |
---|
comment:7 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Wouldn't it be better to fix the strategy members instead. Or have you tried that and there's a problem with it?