C++错误:"Using obsolete binding"
C++ error: "Using obsolete binding"
我的编译器不喜欢以下代码的几件事。任何帮助非常感谢。随意批评我,因为我是一个编程n00b。我知道你们可能很苛刻。
// Method 2, the additive swap, explained inside.
void strrev2(std::string& str) {
unsigned len = str.size();
for (unsigned i = 0, j = len - 1; i < j; i++, j--) {
short a = (int)str[i]; // a is the ASCII value of the i-th character of the string
short b = (int)str[j]; // b is the ASCII value of the j-th character of the string
// Current value of a Current value of b
a = a + b; // a + b b
b = a - b; // a + b a
a = a - b; // b a
}
str[i] = (char)a;
str[j] = (char)b;
}
i,j,a,b
在循环之外不可用for
但您正在尝试for
循环之外访问它们。您可以考虑在循环内移动str[i] = (char)a;
:
for (unsigned i = 0, j = len - 1; i < j; i++, j--) {
....
...
str[i] = (char)a;
str[j] = (char)b;
}
相关文章:
- 使用 [] 运算符时"binding reference of type discards qualifiers"
- 在node-gip binding.gyp文件中,如何根据系统结构(32位、64位)包含不同的库文件
- protobuf in C++ with dynamic binding for google::protobuf::M
- binding.gyp:如何使用"copies"部分在多个位置复制文件
- Binding C++ and Fortran
- SQLite Binding Numaric 数据类型
- Javascript C++ binding?
- Binding to a weak_ptr
- Reg Sqlite binding
- C++错误:"Using obsolete binding"
- c++/MATLAB Mex binding
- CMFCPropertyGridProperty and CCombobox binding
- 在构建Node.js/Node-webkit插件时,通过binding.gyp将.cpp文件编译为Objective-C
- 关于"structural binding"的提案在哪里?
- “VkVertexInputBindingDescription”中的“binding”的目的是什么
- Cocos2d-x lua binding
- Binding to OpenGL 3.x VBO
- constexpr 是编译器的"hint"(如内联)还是"a binding request"?
- C++11 模板参数"late binding"
- Autoconf & C++ & Obsolete headers