Created
June 11, 2012 20:23
-
-
Save snaewe/2912429 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/interprocess/streams/vectorstream.hpp> | |
#include <vector> | |
#include <string> | |
typedef std::vector<char> CharVec; | |
typedef boost::interprocess::basic_vectorstream<CharVec> vectorstream; | |
typedef boost::interprocess::basic_ivectorstream<CharVec> ivectorstream; | |
typedef boost::interprocess::basic_ovectorstream<CharVec> ovectorstream; | |
int main() | |
{ | |
std::string hello("Hello World"); | |
vectorstream vstr; | |
vstr << hello; | |
std::string str; | |
while (vstr && (vstr >> str)) | |
{ | |
std::cout << str << " "; | |
} | |
std::cout << std::endl; | |
CharVec const& vc = vstr.vector(); | |
std::cout | |
<< "size: " << vc.size() | |
<< std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment