vector class

Hi,

When you declare a vector I normally do this:

1
2
3
4
5
6
7
8
9
10
#include <vector>

using namespace std;

int main(void) {
   vector<int> myvector;
   myvector.push_back(2);

   return 1;
}


I have seen in other examples that some programmers choose std::allocator as an allocator for the vector class:

1
2
3
4
5
6
7
8
9
10
#include <vector>

using namespace std;

int main(void) {
   vector<int,allocator<int> > myvector;
   myvector.push_back(2);

   return 1;
} 


When I read the description for the vector class, it already use the default standard allocator. So what is the different between my two code examples, if any?
I'm just curious to know if there is a better performance using the second method.

Regards Jesper
std::vector has std::allocator as default allocator, so there's no difference between the two declarations above. The second one is just being explicit on the allocator
Topic archived. No new replies allowed.