Start New Discussion within our Software Development Community

compiler : visual c++ 2005
os : win7 64bits

#define PARSE_AND_SERIALIZE_WRAPPER(HANDLE, VENDOR)  \
template<>  \
struct parse_and_serialize_wrapper<HANDLE>  \
{  \
  template<typename Request>  \
  bool serialize_req(Request &request, std::string &serialized_msg,   \
                     xml_schema::namespace_infomap &xml_namespace, boost::mpl::vector<serialize_query>);  \
};  \
  \
template<typename Request>  \
bool parse_and_serialize_wrapper<HANDLE>::serialize_req(Request &request, std::string &serialized_msg,  \
                                                        xml_schema::namespace_infomap &xml_namespace, boost::mpl::vector<serialize_query>)  \
{  \
  std::ostringstream oss;  \
  serialize_VENDOR_query_req_msgbody(oss, request, xml_namespace);  \
  serialized_msg.assign(oss.str());  \
  return !serialized_msg.empty();  \
}

It could compile before I spend the macro, but when I spend the macro like

PARSE_AND_SERIALIZE_WRAPPER(stupid_handle, titan);

the compiler always give me the error messages

C2017: illegal escape sequence

this code could work perfectly if I didn't use macro, what is the problem?

I don't know macro very well and seldom use it since at most of the time
C++ give us better choice than macro. But this time I can't find a better
way to solve this kind of problem without macro or just write a code generator
machine for myself.

I don't like macro, but I don't like redundancy codes more than macro.

This question has already been answered. Start a new discussion instead.