Mar 8, 2012 at 1:13am UTC
Can someone point me to the std::sort implementation?
I need to know if it uses new to allocate memory at all. It should, but I want to be certain.
Thanks.
Mar 8, 2012 at 1:32am UTC
As this is implementation, I'd imagine it's compiler dependent. Which are you using?
Mar 8, 2012 at 1:36am UTC
Microsoft Visual Studio 2010, Version 10.0
Mar 8, 2012 at 2:23am UTC
Being it a template function, it should be in the header that is declared. Try it out: Open the header algorithm. I guess it is there.
Mar 8, 2012 at 2:48am UTC
No, it does not use new (or any other allocation function) to allocate memory. It uses copy-construction and assignment, just like all other algorithms.