clone
Description:
Create a copy of this that shares the underlying string pool and containing a list of terms as currently set in this.
Subsequently freeing the original and keeping the clone around is not a problem. The clone works as a standalone term list. The only gotcha may be threading issues because of concurrent access to the shared string pool.
Creating a clone very efficient since only very little memory allocation is required. It's advised that you use a clone instead a new instance whenever you work over a common corpus of strings.
It is also worth noting that terms obtained from the original term list and a clone can be compared directly as pointers (fx. with direct_equal). This is because they share the underlying string pool.
Parameters:
this |
The term list to clone |
Returns:
A newly allocated term list. Free with unref. |