Solved by LeviViana in post #2 
              
              
                I think the best way is to transform the std::ostringstream version of your tensor into a string, you can do it this way: 
std::ostringstream stream;
stream << tensor;
std::string tensor_string = stream.str();