Page 1 of 1

What data types to use?

Posted: Fri Aug 24, 2018 2:10 pm
by MarkusGod
So, I tried to make an array of strings and was presented with tons of array/string types. Are there any documents referring in which case what should I use? Like i should use c++ array/pointer/DynArray/DataBlock/CryString/std::string/etc ? I have found one for 5.2, but I'm on 5.5p6 and there are some types that already non-existent, and some new types.

Re: What data types to use?

Posted: Mon Sep 10, 2018 2:38 pm
by Cry-Flare
This is down to your data design.
The container you use and how you interact and pass around this container to different objects.

If your strings in this array have a fixed length/known length at compile time, then using something like a reserved size vector would be most efficient to store the strings.
If the strings are local to objects that will lookup and use the strings each time they update, then having a vector of pointers where the data is stored in the class itself could be most beneficial.

The strings themselves should ideally use CryString so they make use of our customized logic/memory allocator, unless you want to specifically use the default allocator, then you would use std::string.

Re: What data types to use?

Posted: Mon Sep 10, 2018 5:56 pm
by MarkusGod
Thank you very much for detalaited info! :D I ended up using CSharedString and CArray from Schematic namespace, so they are exposed to the editor.