mardi 1 novembre 2016

Which structure is better for an array of std string

I need a structure as follow:

enter image description here

The structure must holds fixed size std strings and the number of its elements is finit( 100- 10000000).

The only requirement which I need is the ability to access each element Randomely as follow: std::string Temp=MyStrcuture[i]; or MyStrcuture[i]= std::string Temp;

I have to choose the fastest structure with no (possibly) memory leak.

Which one is better for me?

1- Std:string* MyStrcuture = new std::string[Nu_of_Elements];

2- Std::queue< std:string> MyStrcuture(Nu_of_Elements);

3- Std::vector< std:string> MyStrcuture(Nu_of_Elements);

4- Boost::circular_buffer< std::string> MyStrcuture(Nu_of_Elements);

5- Your suggestion?

Aucun commentaire:

Enregistrer un commentaire