[Xapian-tickets] [Xapian] #785: Use std::string_view whenever possible

Xapian nobody at xapian.org
Thu May 9 01:57:33 BST 2024


#785: Use std::string_view whenever possible
-----------------------------+-------------------------------
 Reporter:  German M. Bravo  |             Owner:  Olly Betts
     Type:  enhancement      |            Status:  assigned
 Priority:  highest          |         Milestone:  1.5.0
Component:  Other            |           Version:
 Severity:  normal           |        Resolution:
 Keywords:                   |        Blocked By:
 Blocking:                   |  Operating System:  All
-----------------------------+-------------------------------
Comment (by Olly Betts):

 I noticed that for the functor virtual method case none of the existing
 places that call these functors inside the library would easily benefit
 from being able to pass `std::string_view` - they all take a `std::string`
 from somewhere else and pass it in to the functor.  They also potentially
 actually make things less efficient - consider a user functor which wants
 a zero-byte terminated string to work on, which a `std::string_view` can't
 provide without the user making a `std::string` copy.  It doesn't benefit
 the bindings either since in the functor case we're passing a string from
 C++ to the target language (so much more like the situation with the
 return value in a normal method).

 There may be gains to be made here, but if there are they're going to need
 more widespread changes internally, so I'm thinking we should postpone
 this part for now.
-- 
Ticket URL: <https://trac.xapian.org/ticket/785#comment:12>
Xapian <https://xapian.org/>
Xapian


More information about the Xapian-tickets mailing list