Changes between Initial Version and Version 1 of Ticket #186, comment 3


Ignore:
Timestamp:
14/11/15 20:58:06 (10 years ago)
Author:
Olly Betts

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #186, comment 3

    initial v1  
    11I don't think this will work (otherwise we'd already be doing it!)
    22
    3 If Xapian::MatchDecider just subclasses RefCntBase then it can be reference
     3If `Xapian::MatchDecider` just subclasses `RefCntBase` then it can be reference
    44counted internally, but not externally.  That just won't work.  For example, the
    5 user might not allocate the MatchDecider explicitly:
     5user might not allocate the `MatchDecider` explicitly:
    66
     7{{{
    78    Xapian::MatchDecider foo;
    89    enq.set_matchdecider(&foo);
     10}}}
    911
    10 Or it could be allocated using new[].
     12Or it could be allocated using `new[]`.
    1113
    12 Even if we restrict the user to using new, then the external pointer won't be
     14Even if we restrict the user to using `new`, then the external pointer won't be
    1315reference counted.  How do we know when the last pointer to the object has gone
    1416when there may be an unknown number of external pointers to it?
    1517
    16 So Xapian::MatchDecider would have to be like most other API classes and contain
    17 a RefCntPtr<...> member pointing to an internal class.  But then the user can't
    18 subclass usefully - sub-classing MatchDecider would add member variables to the
     18So `Xapian::MatchDecider` would have to be like most other API classes and contain
     19a `RefCntPtr<...>` member pointing to an internal class.  But then the user can't
     20subclass usefully - sub-classing `MatchDecider` would add member variables to the
    1921pointer, not the object.
    2022
    21 I agree a way to reference count MatchDecider and other similar classes would be
    22 nice, but the RefCntBase approach doesn't seem to work.
     23I agree a way to reference count `MatchDecider` and other similar classes would be
     24nice, but the `RefCntBase` approach doesn't seem to work.