[Xapian-tickets] [Xapian] #332: Avoid const_cast in matcher/queryoptimiser.cc

Xapian nobody at xapian.org
Mon Feb 23 10:41:35 GMT 2009


#332: Avoid const_cast in matcher/queryoptimiser.cc
---------------------+------------------------------------------------------
 Reporter:  richard  |        Owner:  richard  
     Type:  defect   |       Status:  new      
 Priority:  normal   |    Milestone:  1.1.0    
Component:  Matcher  |      Version:  SVN trunk
 Severity:  normal   |   Resolution:           
 Keywords:           |    Blockedby:           
 Platform:  All      |     Blocking:           
---------------------+------------------------------------------------------
Changes (by olly):

  * owner:  olly => richard


Comment:

 Not something I'm planning to work on!

 While I don't like the const_cast (and it's actually exposing C++
 undefined behaviour to the bindings I think, which is something I'd rather
 not do more of), I don't think breaking existing API to address this is
 reasonable.  So just marking the API introduced by this change as
 experimental is an option if we don't address this for 1.1.0.

 How about writing a subclass of Database::Internal which holds a pointer
 to a const Database::Internal object and forwards the const methods (and
 errors on the non-const ones)?

 Then wrap the const Database::Internal pointer in a new one of those
 (instead of using the const_cast), and wrap that in a Database() object to
 pass it to the !PostingSource.

-- 
Ticket URL: <http://trac.xapian.org/ticket/332#comment:1>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list