I take some codes from http://boost-spirit.com/home/articles/karma-examples/output-generation-from-a-list-of-key-value-pairs-using-spirit-karma/
But it wouldn't compile
My compiler : vc++ 2010
os : win7 64bits
#include<iostream>
#include<string>
#include<boost/optional.hpp>
#include<boost/spirit/include/karma.hpp>
namespace karma = boost::spirit::karma;
namespace phoenix = boost::phoenix;
int main()
{
typedef std::back_insert_iterator<std::string> sink_type;
karma::rule<sink_type, std::string()> base = karma::string;
typedef std::pair<std::string, boost::optional<std::string> > pair_type;
karma::rule<sink_type, pair_type()> pair;
pair = karma::string << -('=' << karma::string); //this line can't be compiled
std::cout<<"system pause"<<std::endl;
std::cin.get();
return 0;
}
error message of vc++ 2010
error C2146: syntax error : missing ';' before identifier 'type'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2208: 'boost::type' : no members defined using this type
fatal error C1903: unable to recover from previous error(s); stopping compilation
What is going on and how could I solve it?
Thanks