[Xapian-devel] Bindings and overloading

James Aylett james-xapian at tartarus.org
Thu Jun 3 16:51:14 BST 2004


On Thu, Jun 03, 2004 at 03:38:45PM +0100, Olly Betts wrote:

> > (Also, it works on vector<Query*> not vector<string&>, so you'd need
> > to do something horrible like:
> 
> The C++ template version isn't specific to vector<> or Query* - it
> just relies on the iterators being inputiterators (I think) and
> calls add_subquery() with the dereferenced iterator so as the
> documentation says:
> 
>   The iterators may be to Xapian::Query objects, pointers to
>   Xapian::Query objects, or termnames (std::string-s).
> 
> So if possible, we ought to wrap this so it works with strings without
> having to explicitly build Xapian::Query objects from them first.

We can't easily wrap this directly; the purpose of the %extend
constructor is to avoid needing a direct wrapping for it. Quite why it
takes vector<Query*> and not vector<string&> I have no idea.

Looking at this in a little detail, I'm pretty sure that if we write
an explicit typemap for Python list of Python strings to
vector<string&> then we can change the %extend easily to work.

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org




More information about the Xapian-devel mailing list