我在C++程序中有一个枚举参数,我需要使用一个通过参数返回值的函数来获取该参数.我首先将其声明为int,但在代码审查时要求将其键入为枚举(ControlSource).我做了这个,但它打破了Get()函数 - 我注意到一个C样式转换为int并解决了问题,但是当我第一次尝试使用static_cast <>修复它时,它没有编译.
为什么会这样,为什么当eTimeSource是一个int时,根本不需要转换来通过引用传递整数?
//GetCuePropertyValue signature is (int cueId, int propertyId, int& value);
ControlSource eTimeSource = ControlSource::NoSource;
pPlayback->GetCuePropertyValue(programmerIds.cueId, DEF_PLAYBACKCUEPROPERTY_DELAY_SOURCE, static_cast<int&>(eTimeSource)); //This doesn't work.
pPlayback->GetCuePropertyValue(programmerIds.cueId, DEF_PLAYBACKCUEPROPERTY_DELAY_SOURCE, (int&)(eTimeSource)); //This does work.
int nTimeSource = 0;
pPlayback->GetCuePropertyValue(blah, blah, nTimeSource); //Works, but no (int&) needed... why?
Run Code Online (Sandbox Code Playgroud) 我目前正在使用Visual Studio 2015来处理一个使用NPM/Bower管理Javascript包依赖项的项目.我们正在使用并通过Bower安装的其中一个软件包是knockout-3.4.0.
如果我转到wwwroot/lib/knockout并删除该文件夹,VS Solution Explorer会注意到依赖项节点下不再安装软件包 - 如果我从此菜单运行Restore Packages,它会尝试将knockout拉回lib目录.
但是,每次执行此操作时都无法下载/ dist目录及其中的文件.如果我在我身后的同事机器上做同样的事情(非常相似的构建环境),VS 2015将恢复包括/dist文件夹的包.
我究竟做错了什么?我尝试清理bower缓存并重新安装,但遇到了同样的问题.没有/ dist的内容,应用程序不起作用.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\Bower.cmd" install --force-latest
bower knockout#>=2.2 not-cached https://github.com/SteveSanderson/knockout.git#>=2.2
bower knockout#>=2.2 resolve https://github.com/SteveSanderson/knockout.git#>=2.2
bower knockout#>=2.2 checkout v3.4.0
bower knockout#>=2.2 resolved https://github.com/SteveSanderson/knockout.git#3.4.0
bower knockout#>=2.2 install knockout#3.4.0
Run Code Online (Sandbox Code Playgroud)