“操作符>>>”不匹配在's>>>>>>

编程入门 行业动态 更新时间:2024-10-28 13:27:08
本文介绍了“操作符>>>”不匹配在's>>>>>>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

此函数阻止Wagic:自制软件从编译:

This function is preventing Wagic: the homebrew from Compiling:

/ home / white / Pandora / wagic-read-only / projects / mtg / src / GameOptions。 cpp:1156:error:没有匹配'operator >>'in's >> local'

/home/white/Pandora/wagic-read-only/projects/mtg/src/GameOptions.cpp:1156: error: no match for ‘operator>>’ in ‘s >> local’

源(GameOptions.cpp): code.google/p/wagic/source/browse/trunk / projects / mtg / src / GameOptions.cpp 源代码(一般): code.google/p/wagic/source/browse/

Source(GameOptions.cpp): code.google/p/wagic/source/browse/trunk/projects/mtg/src/ GameOptions.cpp Source(General): code.google/p/wagic/source/browse/

(第1142-1172行)

(Line 1142-1172)

bool GameOptionKeyBindings::read(string input) { istringstream iss(input); vector<pair<LocalKeySym, JButton> > assoc; while (iss.good()) { stringstream s; iss.get(*(s.rdbuf()), ','); iss.get(); LocalKeySym local; char sep; u32 button; s >> local >> sep >> button; if (':' != sep) return false; assoc.push_back(make_pair(local, u32_to_button(button))); } if (assoc.empty()) return false; JGE* j = JGE::GetInstance(); j->ClearBindings(); for (vector<pair<LocalKeySym, JButton> >::const_iterator it = assoc.begin(); it != assoc.end(); ++it) j->BindKey(it->first, it->second); return true; }

如何重写这个来编译?

推荐答案

s >> local

调用默认 operator>> 它不理解你的自定义类 LocalKeySym 所以你需要为你的自定义类重载 Operator>> LocalKeySym 。

Calls the default operator >> which does not understand your custom class LocalKeySym So You need to Overload the Operator >> for your custom class LocalKeySym.

示例代码:

std::istream& operator>>(std::istream& is, LocalKeySym& obj) { // read LocalKeySym obj from stream if( /* no valid object of LocalKeySym found in stream */ ) is.setstate(std::ios::failbit); return is; }

更多推荐

“操作符&gt;&gt;&gt;”不匹配在's&gt;&gt;&gt;&gt;&gt;&

本文发布于:2023-11-06 16:24:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564207.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不匹配   操作   gt   amp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!