areg-sdk icon indicating copy to clipboard operation
areg-sdk copied to clipboard

[c++17] use std::string

Open aregtech opened this issue 3 years ago • 6 comments

  • Replace String
  • Replace WideString

aregtech avatar Oct 23 '21 01:10 aregtech

we merge issues #16 , #17 and #18 to the https://github.com/aregtech/areg-sdk/tree/20220206-stl17-migration

aregtech avatar Feb 06 '22 13:02 aregtech

Good day, @biwiki. Can you please inform whether this ticket is completed or there are still things to do? I am completing the other container migration an would like to start preparing merging with master. Thank you!

aregtech avatar Jun 18 '22 23:06 aregtech

Sorry to say it is still far away from completion, there are lot of things to be done since String is used heavily in the library core

biwiki avatar Jun 19 '22 09:06 biwiki

Hi @biwiki . Thank you for your reply. It's OK, i just wanted to know whether i need to refactor String class or not. On the first step, i'll refactor class String, on second step String with std::string (you were replacing, right?).

aregtech avatar Jun 19 '22 11:06 aregtech

I think I chose to follow the other direction by replacing String with std::string, and deprecating String at the end. And I had also been using other C++17 features along the way, so perhaps it might not be good to merge to master

biwiki avatar Jun 19 '22 11:06 biwiki

At the begin I also tried to do so for containers. For example, tried completely replace TEArrayList with std::vector. It took me very long time and at the end end-up with some mess 😁 There were several problems that needed to fix in parallel. Then i decided to overwrite TEArrayList to keep API maximum close. It worked much better. Did same with other containers. After this refactoring, i have compatibility of containers, but not really the API:

  • TEArrayList --> std::vector
  • TEHashMap --> std::unordered_map
  • TEStack --> std::deque
  • TELinkedList --> std::list

Changes are in 20220528-adapt-stl Same I'll do with the String. Then I'll try wherever is possible to use STL objects. As always, your suggestions / comments are welcomed

aregtech avatar Jun 19 '22 12:06 aregtech

Instead of replacing String or const char * with std::string, implemented String as a wrapper of std::string. All fixes are in 20220701-candidate. Closing the ticket as fixed.

aregtech avatar Aug 16 '22 09:08 aregtech