何时“和”成为C ++中的运算符 [英] When did "and" become an operator in C++

查看:91
本文介绍了何时“和”成为C ++中的运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码看起来像:

I have some code that looks like:

static const std::string and(" AND ");

这会导致g ++中的错误,如下所示:

This causes an error in g++ like so:

Row.cpp:140: error: expected unqualified-id before '&&' token

因此,在诅咒定义andas&&&& amp;的傻瓜后,我添加了

so after cursing the fool that defined "and" as &&, I added

#ifdef and
#undef and
#endif

我得到

Row.cpp:9:8: error: "and" cannot be used as a macro name as it is an operator in C++

这导致我的问题我找不到任何表明它的东西,除了当然是来自g ++的这个消息

Which leads to my question of WHEN did "and" become an operator in C++? I can't find anything that indicates it is, except of course this message from g++

推荐答案

http://en.cppreference.com/w/cpp/language/operator_alternativerel =nofollow>在C ++中定义的几个这样的替代品。您可以使用开关打开/关闭这些开关。

There are several such alternatives defined in C++. You can probably use switches to turn these on/off.

这篇关于何时“和”成为C ++中的运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆