对Integer和String的引用
Reference to Integer and String
谁能解释一下为什么在vc++ 12中String &s = String ("this");int &d = int(10);初始化非const引用时调用哪些操作符。
谢谢。
错误前提:string &s = string("this");
不是有效的c++。左值引用不能绑定到右值
相关文章:
- OpenCV 3.4.3 中对 'cv::String::d eallocate()' 错误的未定义引用
- 我正在将一个 std::string 传递给一个 boost 函数,该函数对该类型进行常量引用,但该值发生了变化
- 为什么当我使用 std::string::operator[] 时自动变量不会成为引用?
- std::string::find 为取消引用的迭代器和等效字符串文本返回不同的值
- std::shared_ptr<std::string const> 可以作为引用计数的不可变字符串的有效实现吗?
- Cpp 未定义引用 'Apache:: thrift:: transport:: TSocket:: TSocket (std:: string const&, int)'
- 有条件地分配 std::string 作为引用
- 为什么 std::runtime_error 的 c'tor 经常引用 std::string?
- 如何在我的源代码中找到所有发生的情况,其中std :: string被传递给方法作为副本而不是恒定引用
- 我可以在循环中引用 std::string 的一部分并将其放在外面吗?
- C ++如果我使用引用,为什么要清空我的map<string,string>?
- 对"cv::String::allocate(unsigned long)"的未定义引用
- 对'PreconditionViolatedException::PreconditionViolatedException(std::string const&)'的未定义引用
- 链接webrtc本机时出错,因为未定义对具有std::string的方法的引用
- 类型为'std::string&的非常量引用的初始化无效,并且从类型为'std::basic_string<char>的右值
- 在结构的联合成员中使用std::string时,无法引用默认构造函数
- 为什么 std::string 的 back() 应该返回对字符的引用?
- 通过引用传递 std::string 不会更新调用函数中的字符串值
- 为什么解引用string vector迭代器需要括号
- 将非常量向量传递给引用<string> const 向量<const string>?