草庐IT

member_number

全部标签

c++ - 重新发明轮子 : Random Number Generator

所以我是C++的新手,正在尝试学习一些东西。因此,我正在尝试制作一个随机数生成器(如果您愿意,可以使用RNG或PRNG)。我对RNG有基本的了解,比如你必须从种子开始,然后通过算法发送种子。我坚持的是人们如何提出上述算法。这是我必须获得种子的代码。intgetSeed(){time_trandSeed;randSeed=time(NULL);returnrandSeed;}现在我知道在C++中有预构建的RNG,但我希望学习的不仅仅是复制其他人的工作并尝试弄清楚。因此,如果有人能引导我到可以阅读的地方或向我展示如何为此提出算法的示例,我将不胜感激。 最佳答案

c++ - Lambda 捕获列表 : capturing object's member field by value not possible without capturing the whole object?

下面的代码voidCMainWindow::someMethod(constCLocationsCollection&parentItem){autof=[this,parentItem.displayName](){};}给我一​​个错误:errorC2143:syntaxerror:missing']'before'.'如果我想通过ref捕获parentItem.displayName,我会为它创建一个非依赖别名标识符:constQString&name=parentItem.displayName;autof=[this,&name](){};//Orshoulditbe[thi

C++11 : error: ‘begin’ is not a member of ‘std’

我正在尝试执行以下操作:source=newint[10];dest=newint[10];std::copy(std::begin(source),std::end(source),std::begin(dest));但是,编译器报如下错误。copy.cpp:5434:14:error:‘begin’isnotamemberof‘std’copy.cpp:5434:44:error:‘end’isnotamemberof‘std’copy.cpp:5434:72:error:‘begin’isnotamemberof‘std’我已经包含了所需的代码中的header。有人可以帮我解决这

c++ - '&' : illegal operation on bound member function expression

这个问题在这里已经有了答案:Printaddressofvirtualmemberfunction(5个答案)关闭7年前。当我尝试从具有主要功能的单个cpp文件时,这有效,sprintf(smem_options,"#transcode{vcodec=RV24}:smem{""video-prerender-callback=%lld,""no-time-sync},",(longlongint)(intptr_t)(void*)&cbVideoPrerender);如何在类中将函数参数传递给sprintf?sprintf(smem_options,"#transcode{vcodec

c++ - std::is_member_function_pointer 不适用于 noexcept 成员函数

我在使用std::is_member_function_pointer时遇到问题。据我所知,在给定noexcept成员函数时它不起作用。我在标准中找不到任何声明它不适用于noexcept合格成员函数的内容。问题示例:#includeclassA{public:voidmember()noexcept{}};intmain(){//failsatcompiletimeifA::memberisadatamemberandnotafunctionstatic_assert(std::is_member_function_pointer::value,"A::memberisnotamemb

c++ - decltype( (A{}.int_member) ) 的正确结果是什么?

给定类型A的定义:structA{inti;};根据规范[expr.ref](我使用了n4618):(ifE2isnon-reference,)...IfE1isanlvalue,thenE1.E2isanlvalue;otherwiseE1.E2isanxvalue...显然A{}.i是xvalue;还考虑到[dcl.type.simple]:(fordecltype(e),)—...ifeisanunparenthesizedid-expressionoranunparenthesizedclassmemberaccess...—otherwise,ifeisanxvalue,de

c++ - 错误 C2039 : 'find' : is not a member of 'std'

我刚遇到一个奇怪的错误,说find不是std的成员。errorC2039:'find':isnotamemberof'std'errorC3861:'find':identifiernotfound基本上,我想查找是否可以在vector中找到一个字符串知道为什么会这样吗?代码帮助告诉我在std中有find方法。这基本上就是我所做的:#include"OperatorUtil.h"#include#include#include#include#includeusingnamespacesaeConfig;namespaceoperatorUtil{boolisIn(constFilte

c++ - 提升元组 : increasing maximum number of elements

boosttupledocumentation说:Thecurrentversionsupportstupleswith0-10elements.Ifnecessary,theupperlimitcanbeincreasedupto,say,afewdozenelements.但是,我找不到它说明如何执行此操作的位置。我希望元组具有BOOST_MPL_LIMIT_VECTOR_SIZE元素(默认为20)。这是因为我在mpl::vectors和boost::tuples之间进行映射,并且希望所有容器都具有相同数量的元素。 最佳答案 元

c++ - Visual Studio 编译器警告 C4250 ('class1' : inherits 'class2::member' via dominance)

以下代码生成警告C4250。我的问题是,最好的解决方案是什么?classA{virtualvoidfunc1();}classB:publicA{}classC:publicA{virtualvoidfunc1();}classD:publicB,publicC{}intmain(){Dd;d.func1();//Causeswarning}根据我的阅读,应该可以这样做:classD:publicB,publicC{usingB::func1();}但是,这实际上并没有做任何事情。我目前解决的方法是:classD:publicB,publicC{virtualvoidfunc1(){B

c++ - dumpbin 导出输出中的@number 是什么

在带有/EXPORTS或/IMPORTS的C++.DLL(或IMPLIB.LIB文件)上使用DUMPBIN我在输出中看到如下语法:Exportsordinalname_CloseConduit@4_ConduitPort_GetConduitVersion@4_GetStatusConduit@8_GetTimeout@0_OpenConduit@4我在任何地方都找不到@n名称的定义。我终于得出结论,它是参数数据的字节数,但根据几个例子的推断,这让我有点紧张。任何人都可以指出一个引用,或以任何权威的方式说出这里的数字是什么意思吗? 最佳答案