Changes between Initial Version and Version 1 of Ticket #186, comment 3
- Timestamp:
- 14/11/15 20:58:06 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #186, comment 3
initial v1 1 1 I don't think this will work (otherwise we'd already be doing it!) 2 2 3 If Xapian::MatchDecider just subclasses RefCntBasethen it can be reference3 If `Xapian::MatchDecider` just subclasses `RefCntBase` then it can be reference 4 4 counted internally, but not externally. That just won't work. For example, the 5 user might not allocate the MatchDeciderexplicitly:5 user might not allocate the `MatchDecider` explicitly: 6 6 7 {{{ 7 8 Xapian::MatchDecider foo; 8 9 enq.set_matchdecider(&foo); 10 }}} 9 11 10 Or it could be allocated using new[].12 Or it could be allocated using `new[]`. 11 13 12 Even if we restrict the user to using new, then the external pointer won't be14 Even if we restrict the user to using `new`, then the external pointer won't be 13 15 reference counted. How do we know when the last pointer to the object has gone 14 16 when there may be an unknown number of external pointers to it? 15 17 16 So Xapian::MatchDeciderwould have to be like most other API classes and contain17 a RefCntPtr<...>member pointing to an internal class. But then the user can't18 subclass usefully - sub-classing MatchDeciderwould add member variables to the18 So `Xapian::MatchDecider` would have to be like most other API classes and contain 19 a `RefCntPtr<...>` member pointing to an internal class. But then the user can't 20 subclass usefully - sub-classing `MatchDecider` would add member variables to the 19 21 pointer, not the object. 20 22 21 I agree a way to reference count MatchDeciderand other similar classes would be22 nice, but the RefCntBaseapproach doesn't seem to work.23 I agree a way to reference count `MatchDecider` and other similar classes would be 24 nice, but the `RefCntBase` approach doesn't seem to work.