Move constructor for ICU string

I wrote a wrapper class for the ICU string, and I have a compiler with move support, but ICU does not provide a move constructor. I was also unable to find the swap () function that I could use to do this work. How can I implement move semantics for ICU string?

+4
source share
1 answer

If you handle the overhead of dereferencing a pointer every time you access a string (I wouldn’t), you can always save the icu string to std::unique_ptr , then moving around will be as easy as moving the pointer.

 MyWrapper(MyWrapper && that) :str_ptr(std::move(that.str_ptr)) {} 

Personally, I would feel better actually changing the source of the ICU.

+4
source

Source: https://habr.com/ru/post/1415384/


All Articles