[Xapian-tickets] [Xapian] #401: Weight cannot be subclassed in bindings

Xapian nobody at xapian.org
Mon Oct 7 19:04:30 BST 2024


#401: Weight cannot be subclassed in bindings
-----------------------------+-------------------------------------------
 Reporter:  James Aylett     |             Owner:  Not currently assigned
     Type:  enhancement      |            Status:  new
 Priority:  lowest           |         Milestone:
Component:  Xapian-bindings  |           Version:
 Severity:  minor            |        Resolution:
 Keywords:                   |        Blocked By:
 Blocking:                   |  Operating System:  All
-----------------------------+-------------------------------------------
Comment (by Olly Betts):

 > the downside is that any user subclass of `Xapian::Weight` needs to
 have:
 > {{{
 >     operator const MyWeight&() const { return *this; }
 > }}}

 Seems this probably isn't part of the solution anyway, but it occurs to me
 that we only need to be able to implicitly convert to a `const Weight&` so
 we could probably just add this to the `Xapian::Weight` class itself
 instead and not require special code in every subclass:

 {{{
     operator const Weight&() const { return *this; }
 }}}
-- 
Ticket URL: <https://trac.xapian.org/ticket/401#comment:9>
Xapian <https://xapian.org/>
Xapian


More information about the Xapian-tickets mailing list