C++ C预处理器在字符串文本中插入/追加标记

C++ C预处理器在字符串文本中插入/追加标记,c++,c++11,c-preprocessor,C++,C++11,C Preprocessor,我有以下宏: #define ASSERT_ITERATOR_VALUE_TYPE(Iterator__, Value_type__) \ static_assert(std::is_same<Value_type__, typename Iterator__::value_type>::value, \ "Expected iterator with value type #Value_type__") 我会得

我有以下宏:

#define ASSERT_ITERATOR_VALUE_TYPE(Iterator__, Value_type__)                      \
static_assert(std::is_same<Value_type__, typename Iterator__::value_type>::value, \
              "Expected iterator with value type #Value_type__")
我会得到消息:

error: static assertion failed: Expected iterator with value type #Value_type__
                                                                  ^^^^^^^^^^^^^
error: static assertion failed: Expected iterator with value type double
                                                                  ^^^^^^
相反,我想把信息带到哪里:

error: static assertion failed: Expected iterator with value type #Value_type__
                                                                  ^^^^^^^^^^^^^
error: static assertion failed: Expected iterator with value type double
                                                                  ^^^^^^

Q 是否有某种预处理器魔法可以帮助我实现我不想要的功能?

\35;定义断言\u迭代器\u值\u类型(迭代器\u,值\u类型)\
#define ASSERT_ITERATOR_VALUE_TYPE(Iterator__, Value_type__)                      \
static_assert(std::is_same<Value_type__, typename Iterator__::value_type>::value, \
              "Expected iterator with value type " #Value_type__)
静态断言(std::is_same::value\ “值类型为“”的预期迭代器值类型为“”)
将宏参数展开为字符串文字,然后依赖字符串文字连接。

\35;定义断言迭代器值类型(迭代器值类型)\
静态断言(std::is_same::value\
“值类型为“”的预期迭代器值类型为“”)

您可以将宏参数扩展为字符串文字,然后依赖字符串文字连接。

请参阅不要发送垃圾邮件,标记!这不是C@奥拉夫C是相当多的C++。加上预处理器来自C。“这个问题似乎不是关于在帮助中心定义的范围内编程。”耶稣基督。。。回到工作中…@ 101010:请提供一个C标准的引用,其中允许模板、继承、用户名称空间等,以及允许VLAS、FAMS等的C++标准。我没有删除预处理器标签。不过,C标记是胡说八道。请参见不要垃圾邮件,标记!这不是C@奥拉夫C是相当多的C++。加上预处理器来自C。“这个问题似乎不是关于在帮助中心定义的范围内编程。”耶稣基督。。。回到工作中…@ 101010:请提供一个C标准的引用,其中允许模板、继承、用户名称空间等,以及允许VLAS、FAMS等的C++标准。我没有删除预处理器标签。不过,C标记是胡说八道。