I\'m making a C++ wrapper for a piece of C code that returns a large array, and so I\'ve tried to return the data in a vector.
Now t
Sorry, there's no way to avoid it.
C++11 adds a constructor that takes only a size, but even that will value-initialize the data.
Your best bet is to just allocate an array on the heap, stick it in a unique_ptr (where available), and use it from there.
If you're willing to, as you say, "hacking into STL," you could always grab a copy of EASTL to work from. It's a variation of certain STL containers that allows for more restricted memory conditions. A proper implementation of what you're trying to do would be to give its constructor a special value that means "default initialize the members," which for POD types means to do nothing to initialize the memory. This requires using some template metaprogramming to detect if it is a POD type, of course.