Why are not std: allocator static member functions

std:allocator

stateless . In other words, memory being allocated a1.allocate()

( a1

is one instance std::allocator

) can be freed a2.deallocate()

( a2

is another example std::allocator

).

Why aren't they static member functions?

(edited October 17, 2014 :)

Ok, thanks luk32. Since C ++ 11 custom allocator

can have states , that might be the reason std::allocator

those non-static member functions have.

+3
c ++ stl


source to share


No one has answered this question yet

Check out similar questions:

23498
Why is processing a sorted array faster than processing an unsorted array?
2437
Why "using the std namespace;" considered bad practice?
2116
Why are stigmental additions much faster in individual cycles than in combined cycles?
1675
Why is reading lines from stdin much slower in C ++ than Python?
1643
Why templates can only be implemented in a header file?
1483
Why should I use a pointer and not the object itself?
1406
Why does changing 0.1f to 0 slow down performance by 10x?
1138
Why do we need virtual functions in C ++?
3
use c ++ 11 lambda in a non-static member function and call a static member function of the same class
3
What is the purpose of the static member functions in STL allocator_traits?



All Articles
Loading...
X
Show
Funny
Dev
Pics