草庐IT

Types-TypeScript

全部标签

C++ 错误 : Incompatible types in assignment of ‘char*’ to ‘char [2]

我的构造函数有点问题。在我的头文件中,我声明:charshort_name_[2];和其他变量在我的构造函数中:Territory(std::stringname,charshort_name[2],Player*owner,charunits);voidsetShortName(char*short_name);inlineconstchar(&getShortName()const)[2]{returnshort_name_;}在我的cpp文件中:Territory::Territory(std::stringname,charshort_name[2],Player*owner,

C++11 "enumerated types"(17.5.2.1.2)

引自C++11标准(17.5.2.1.2枚举类型):1SeveraltypesdefinedinClause27areenumeratedtypes.Eachenumeratedtypemaybeimplementedasanenumerationorasasynonymforanenumeration(Suchasanintegertype,withconstantintegervalues(3.9.1)).2Theenumeratedtypeenumeratedcanbewritten:enumenumerated{V0,V1,V2,V3,.....};staticconstenu

c++ - VC++ 2010 中的 "moveable-only types"问题

我最近安装了VisualStudio2010ProfessionalRC来试用它并测试在VC++2010中实现的几个C++0x功能。我实例化了std::unique_ptr的std::vector,没有任何问题。但是,当我尝试通过将临时对象传递给push_back来填充它时,编译器会提示unique_ptr的复制构造函数是私有(private)的。我尝试通过移动它来插入一个左值,它工作得很好。#include#includeintmain(){typedefstd::unique_ptrint_ptr;int_ptrpi(newint(1));std::vectorvec;vec.pu

c++ - 如何将 "invalid operands of types ' const char' 修复为二进制 'operator+'?

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:HowdoIconcatenatemultipleC++stringsononeline?根据thisC++std::string使用operator+连接。那么为什么这段代码usingnamespacestd;stringsql="createtablem_table("+"pathTEXT,"+"qualityREAL,"+"foundINTEGER);";导致这个错误?invalidoperandsoftypes'constchar[22]'and'constchar[17]'tobinary'oper

windows - 如何在 Windows 上以 'Watch output files' 模式 (tsc -w) 使用 TypeScript 编译器?

安装VS插件的编译器版本没有这个选项,但是node.js的版本有。但是我不能让这个模式在Windows上工作。它创建空文件并且不编译任何东西。这是一个已知的错误吗?这可以帮助吗?我不想使用重量级的VS,创建VS项目等等。更新:我提交了一个bug. 最佳答案 -w除了在Node上不受支持。如果您甚至运行help命令,除非您使用的是node,否则您将不会得到-w。让它在非Node运行时工作将是在codeplex上提出的一个很好的建议http://typescript.codeplex.com/workitem/list/basic

ruby-on-rails - rails : soulmate gem pipelining for multiple types

我正在使用soulmate我的Rails应用程序中用于自动完成的gem,我遇到的一个大问题是从客户端到Redis服务器再返回的查询延迟。快速浏览gem代码显示#inlib/soulmate/server.rb#searchtypes.eachdo|type|matcher=Matcher.new(type)results[type]=matcher.matches_for_term(term,:limit=>limit)end如您所见,为每个类型(即“location”、“user”、“venue”、等),然后使用matches_for_term方法查询Redis服务器。这意味着如果我

javascript - 尝试将 Redis 集成到 Node.js (TypeScript) 时出现断言错误

有些人对Redis有点陌生,对这里的Node有点新手。我一直在尝试将node-redis模块与我一直在从事的TypescriptNode项目集成,我一直在使用mocha进行测试,并且柴。我正在尝试编写可以与我的项目的其余部分集成的基本Getter/Setter函数(我正在使用Redis来跟踪FacebookMessengerBot的状态)。每当我尝试使用setKeyValue函数向数据库写入一个新的键值对时,事务都会通过(通过redis-cli客户端验证)),但是setKeyValue和getValueFromKey返回的值与数据库事务成功时应返回的值不对应。我编写的代码实现如下(在我

node.js - Redis 中的 typescript 错误 - 事件

import*asredisfrom'redis'importconfigfrom'../../config/config'constclient=redis.createClient(config.redis.port,host,config.redis.options);client.on('ready',()=>{console.log('redisisready.')});在typescript中出现以下错误[ts]属性'on'不存在于类型'{address:any;connection_options:{[x:string]:任何;};connection_id:数字;连接:

typescript - socket.io-redis typescript 错误

我试过像这样使用@types/socket.io-redis:import{ServerasHttpServer}from'http';importsocketIo,{Socket}from'socket.io';importredis,{RedisAdapter}from'socket.io-redis';exportdefaultfunctionsetupWebsocket(server:HttpServer){constio=socketIo().listen(server);io.adapter(redis(process.env.REDIS_URL));constadapte

types - 为什么 Kotlin 不支持无符号整数?

我最近遇到了一种情况,其中无符号整数非常有用(例如,任何负值都没有意义等)。令人惊讶的是,我发现Kotlin不支持无符号整数——而且似乎没有其他任何关于原因的信息(尽管我已经看过了)。我错过了什么吗? 最佳答案 Byte、Short、Int和Long的未签名对应项确实存在于Kotlin1.3的Beta版中,并且是stableasofKotlin1.5:来自docs:kotlin.UByte:anunsigned8-bitinteger,rangesfrom0to255kotlin.UShort:anunsigned16-bitint