This is an example of how to use the TextStream namespace.It can be built by launching
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <map>
#include "latbuilder/TextStream.h"
namespace CustomSpace {
struct CustomType {
CustomType(const std::string& s): value(s) {}
std::string value;
};
std::ostream& operator<<(std::ostream& os, const CustomType& x)
{ return os << "CustomType(" << x.value << ")"; }
}
using namespace CustomSpace;
int main(int argc, const char *argv[])
{
using TextStream::operator<<;
std::cout << "TextStream Test" << std::endl;
std::cout << vector<int>{1, 2, 3, 4, 5} << std::endl;
std::cout << list<string>{"abc", "def", "ghi", "xyz"} << std::endl;
std::cout << pair<string, int>{"abc", 3} << std::endl;
std::cout << map<string, int>{{"abc", 3}, {"def", 7}, {"ghi", 10}} << std::endl;
std::cout << map<string, vector<int>>{{"abc", {1,2,3}}, {"def", {4,5,6}}, {"ghi", {7,8,9}}} << std::endl;
std::cout << list<CustomType>{CustomType("abc"), CustomType("def")} << std::endl;
std::cout << std::setw(12);
return 0;
}