Code:
return &result[0];



Or, if you work with C++11, you can also use the data() method on the std::vector<>. Keep in mind, unlike std::deque or the like, std::vector is guaranteed to allocate a contiguous memory block!

Though, there is one problem... First of all, Lite-C doesn't know about std::string, and second of all... Well, you are using an auto variable there, which goes out of scope once you return from the function.

A better way to handle these kinds of things, is letting the user supply a buffer and a size to the function, and then filling the buffer in your method with the designated data type.


(By the way, in case you use C++11: Use the new auto type for your loop, and use >> in your template. And just in general, it looks like you've put "using namespace std" somewhere... Don't do that, "using namespace" is inherently flawed, avoid it and just type the "std::" (and if you have to use it, make sure that the translation unit is private!)).


His words are wise, his face is beard.