返回的内容以及本文档描述的功能中所采取的措施
What is being returned and what is being taken in the function described by this documentation?
我正在从http://www.boost.org/doc/libs/1_54_0/doc/doc/html/boost/boost/boost/program_options/variables_map.map.html
const variable_value & operator[](const std::string & name) const;
我正在考虑评估C 项目的逻辑。您无法从C 中的函数返回数组,因此我对在参数列表之前的方括号感到困惑。我也对为什么在尾随列表之后有一个const感到困惑。
尾随const表示函数中的"此"参数也为const。这意味着在此函数中不能突变类状态,并且该函数不能调用其他非const成员函数。
功能签名本身使[]运算符超载。该函数的返回类型为" const variable_value&"。超载[]运算符使您可以按照您想要的任何形式索引您的课程。通常,[]用于访问元素(arr [1] ==数组的第二个元素)。使用此过载,可以用字符串参数(ThatClass [" Somestring"])索引类。
相关文章:
- 正在查找文档以获得PS4平台的C++中的设备信息
- 如何在文档文件夹中创建目录
- 当Microsoft文档仅包含 C# 示例时,如何查找 C++ 包含文件名
- 通过构造函数创建一些值并尝试添加到文档中使用 rapidjson 不起作用
- 关于类的 Python 文档 - 对C++的引用不正确
- C++/autoconf 等效于文档库要求.txt的要求是什么?
- mbed:使用 USB 文档库编译会导致错误
- C++ VISUAL STUDIO:GLFWwindow没有初始化,即使它是在文档中编写的并且以前工作过
- 使用 yaml-cpp 更新 YAML 文档的节点和值
- 在加载 MSHTML 文档之前从 MSHTML 文档中删除无效的 URL
- 如何在C++中表示JSON文档的递归对象结构?
- 如何查找 Redshift Maya API 文档?
- 如何使用值模板编写文档测试用例?
- 如何使用 Gradle DSL(领域特定语言)上的文档?
- ncurses 找不到任何关于cchar_t的文档
- 提取狮身人面像文档中的C++代码片段
- 关于 API 文档和设备操作 在助手-sdk-cpp 上
- Doxygen:为什么@name使以下所有功能都被视为文档
- 在C++头文件中的原型上复制的功能文档 -> Doxygen
- 由define保护的文档功能