草庐IT

Service_Name

全部标签

c++ - 如何修复错误 : unknown type name ‘namespace’

#ifndefUNO_ACTION_#defineUNO_ACTION_namespaceUno{namespaceGame{classGame;}}//namespacenamespaceUno{namespaceAction{using::Uno::Game::Game;classAction{public:virtualboolisDisposeable()=0;virtualvoidtakeAction(Game*game)=0;virtual~Action(){}};}}#endif我在ubuntu12.04上编译这些代码,它返回错误集:action.h:4:1:error:

c++ - 无法从 boost::asio::io_service::run 捕获异常

我在boost::asio上有一个TCP服务器,它监听连接并在获取连接后开始使用boost::asio::write在循环中发送数据block。boolTcpServer::StartTcpServer(std::shared_ptrio_service){m_ioservice=io_service;m_acceptor.reset(newboost::asio::ip::tcp::acceptor(*m_ioservice,boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(),m_port)));m_socket=std

c++ - 尝试包装函数返回值时出现 "<class name> does not provide a call operator"错误

我正在尝试编写一个函数,它将一个仿函数作为参数,调用仿函数,然后返回它的返回值,并将其包装在boost::shared_ptr中。以下拒绝编译,我完全没有想法。我得到“std::vector不提供调用操作符”(大致)。我在MacOSX上使用Clang3.1。templateboost::shared_ptrReturnValueAsShared(boost::functionfunc){returnboost::make_shared(func());}这是我尝试使用它的上下文:make_shared>>>(bind(ReturnValueAsShared>,bind([afuncti

c++ - 使用 boost socket ,我只需要一个io_service吗?

在几个不同的线程中具有多个连接。.我基本上是在做一个使用boost/asio.hpp和tcp的基本类。现在我正在阅读:http://www.boost.org/doc/libs/1_44_0/doc/html/boost_asio/tutorial/tutdaytime1.html它说:“所有使用asio的程序都必须至少具有一个io_service对象。”所以我的基类应该有一个静态的io_service(这意味着所有程序只有1个,并且所有不同的线程和连接都将使用相同的io_service对象)或使每个连接都有自己的io_service?谢谢你在前面!更新:好的,所以基本上我希望做的是为

c++ - Type** name 和 Type* name[] 有什么区别?

Type**name和Type*name[]有什么区别?为什么有人会使用一个而不是另一个?谢谢 最佳答案 这取决于它是在变量声明中还是在函数参数中?如果在变量声明中:Type**name=&pointer_to_type;Type*name[]={&pointer_to_type,0,&pointer_to_type};第一个是指向类型的指针,而第二个是指向长度为3的类型的指针数组。如果在函数参数中,它们是一样的。数组衰减为指针,Type**name和Type*name[]与函数参数完全相同。但是,第二种形式清楚地表明name是一个

c++ - 错误 : c++ [map] does not name a type

我编写了以下内容作为文本冒险游戏的文本命令解析器的一部分。我试图将用户输入的字符串与枚举类中的项目相关联。以下是我的头文件:#include#include#includeusingnamespacestd;enumclassNoun{//Interrogationsubjectsname,//askthesubjecthisnamebase,//whereisthebase?attack,//whenwilltheattackbe?invalid};mapknownNouns;knownNouns["name"]=Noun::name;knownNouns["base"]=Noun:

c++ - io_service::run() 的专用线程

我想提供一个由一个全局线程驱动的全局io_service。很简单,我只是让线程主体调用io_service::run()。但是,这不起作用,因为run(run_one,poll,poll_one)如果没有工作则返回去做。但是,如果线程反复调用run(),就会在无事可做时忙循环。我正在寻找一种方法让线程在io_service中没有任何工作要做时阻塞。我可以在混合中添加一个全局事件,以便线程阻塞。但是,这将要求io_service的用户在每次使用该服务时通知该事件。不是理想的解决方案。注意:没有实际的全局变量,我从不使用事件进行并发我只是将问题简化为我的确切需要。真正的目标是一个不需要io

class - Class< 的语法是什么?在 kotlin 中扩展 class_name>?

我正在尝试创建一个接受从Word_Class继承的任何类变量但它不起作用的Arraylist:varlst=ArrayList>();lst.add(Class);我正在寻找Class 最佳答案 您可以使用outtypeprojection在Kotlin。它相当于?扩展Java中的T,例如://v---outtypeprojectionvarlst=ArrayList>()要获得一个Java类你应该使用KClass#java,例如://v---getaKClassinstancelst.add(Noun_Class::class.j

class - Class< 的语法是什么?在 kotlin 中扩展 class_name>?

我正在尝试创建一个接受从Word_Class继承的任何类变量但它不起作用的Arraylist:varlst=ArrayList>();lst.add(Class);我正在寻找Class 最佳答案 您可以使用outtypeprojection在Kotlin。它相当于?扩展Java中的T,例如://v---outtypeprojectionvarlst=ArrayList>()要获得一个Java类你应该使用KClass#java,例如://v---getaKClassinstancelst.add(Noun_Class::class.j

c++ - 在 OSX 10.9.1 上使用 g++ 编译时出错 : unknown type name '__darwin_wctype_t'

在OSX10.9.1上使用g++从命令行编译基本代码(我附加了一个helloworld作为示例)时#includeintmain(){std::cout我用命令编译:g++hello.cc-ohw这会生成以下错误消息:Infileincludedfromhello.cc:1:Infileincludedfrom/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iostream:38:Infileincludedfrom/Applicat