1

Topic: boost:: scoped_array vs std:: vector

Tell what advantages





boost:: scoped_array <double> ar (new double [size]); 




Before the customary





std:: vector <double> ar (size); 



What for to make a fuss when in STL vector solves  the task and has more

The advanced functional

I do not object on transfer of a topic to sacred wars but it would be desirable argued

Arguments

2

Re: boost:: scoped_array vs std:: vector

Hello, Kirpa V. A,

I think the same as at boost:: scoped_ptr vs std:: auto_ptr

- Speed

- The intention (i.e., you explicitly say that at you the size does not change) is more obvious

3

Re: boost:: scoped_array vs std:: vector

Hello, Kirpa V. A, you wrote:

> Tell what advantages

>

> boost:: scoped_array <double> ar (new double [size]); 
> 


> before the customary

>


> std:: vector <double> ar (size);  
> 


> What for to make a fuss when in STL vector solves  the task and has more
> the advanced functional
> I do not object on transfer of a topic to sacred wars but it would be desirable argued
> arguments


I do not know what here to compare... Absolutely different concepts, with different functionality.

std:: vector it is the container, and boost:: scoped_array idle time  over the bare pointer.

Accordingly the decision on usage of this or that means to be accepted depending on that that should is necessary for you.

4

Re: boost:: scoped_array vs std:: vector

Hello, Kirpa V. A, you wrote:


std:: vector <> in typical implementation contains 3 pointers, and boost:: scoped_array <> - only one. In some cases it can become very important advantage.

5

Re: boost:: scoped_array vs std:: vector

Hello, LuciferMoscow, you wrote:

LM> I think the same as at boost:: scoped_ptr vs std:: auto_ptr
LM> - speed


Here read that STLPort has artfully ground  on specific templates (that types of a pool of storage)

Then can be at active  std:: vector will faster

By the way in my project passage with standard STL on STLPort gave ~70 % a productivity gain

Generally for a long time it is necessary on rn article about competent performance comparison STL vector and  array

LM> - the intention (i.e., you explicitly say that at you the size does not change) is more obvious


Well I do not know it is possible to carry it to advantages

6

Re: boost:: scoped_array vs std:: vector

Hello, Kirpa V. A, you wrote:

> Tell what advantages

>

> boost:: scoped_array <double> ar (new double [size]); 
> 


> before the customary

>


> std:: vector <double> ar (size);  
> 


> What for to make a fuss when in STL vector solves  the task and has more
> the advanced functional
> I do not object on transfer of a topic to sacred wars but it would be desirable argued
> arguments


I consider that no significant advantages are present. As well as scope_ptr it is better nothing const auto_ptr (and even there is one lack: scope_ptr all the same can lose possession by means of swap). Arguments about  clearness scope_ptr  to me doubtful taking into account that propagation which has auto_ptr.


Though  it has essential practical value (since is shared_ptr), all one application I see - it is possible to write scoped_array <auto_ptr <>>. For vector basically too it is possible if precisely to know that the size not to increase, but it is dangerous to attending.

7

Re: boost:: scoped_array vs std:: vector

When in the program there are the different entities doing same, but with different "", the confusion begins.

The
author: WolfHound

Date: 30.05.05(Here it is recommended to use scoped_ptr in object that explicitly contradicts even to its title though it is functional absolutely correctly). Therefore, in my judgement, anything except a headache from a choice problem, it does not give.