草庐IT

namespace-scoped

全部标签

linux - 未授权查询 mongodb 上的 admin.system.namespaces

我启动一个新的mongo实例,创建一个用户,授权它,但是当我运行“showcollections”时,系统说id没有被授权。不知道为什么?#mongoadminMongoDBshellversion:2.4.3connectingto:adminServerhasstartupwarnings:ThuMay2318:23:56.735[initandlisten]ThuMay2318:23:56.735[initandlisten]**NOTE:Thisisa32bitMongoDBbinary.ThuMay2318:23:56.735[initandlisten]**32bitbui

c++ - fcgio.cpp :50: error: 'EOF' was not declared in this scope

我正在尝试在LinuxUbuntu10.x机器上构建fastcgi。我运行以下命令:./配置制作我收到以下错误:fcgio.cpp:Indestructor'virtualfcgi_streambuf::~fcgi_streambuf()':fcgio.cpp:50:error:'EOF'wasnotdeclaredinthisscopefcgio.cpp:Inmemberfunction'virtualintfcgi_streambuf::overflow(int)':fcgio.cpp:70:error:'EOF'wasnotdeclaredinthisscopefcgio.cpp

c++ - "not declared in this scope"模板和继承错误

这个问题在这里已经有了答案:WhydoIhavetoaccesstemplatebaseclassmembersthroughthethispointer?(3个回答)accessingprotectedmembersofsuperclassinC++withtemplates[duplicate](2个回答)关闭8年前。这是重现我的问题的代码示例:templateclassBase{public:Base(){}virtual~Base(){}protected:intmyOption;virtualvoidset()=0;};templateclassChildClass:publ

c++ - 错误 : strcpy was not declared in this scope

我在Ubuntug++版本4.4.3中编译的c++问题中遇到了这个问题。我不知道要包含哪些标题来解决这个问题。谢谢centro_medico.cpp:Inconstructor‘Centro_medico::Centro_medico(char*,char*,int,int,float)’:centro_medico.cpp:5:error:‘strcpy’wasnotdeclaredinthisscopecentro_medico.cpp:13:warning:deprecatedconversionfromstringconstantto‘char*’centro_medico.c

c++ - 我在哪里将常量字符串放在 C++ : static class members or anonymous namespaces? 中

我需要定义一些仅由一个类使用的常量字符串。看起来我有三个选择:将字符串直接嵌入到使用它们的位置。将它们定义为类的私有(private)静态常量成员://A.hclassA{private:staticconststd::stringf1;staticconststd::stringf2;staticconststd::stringf3;};//A.cppconststd::stringf1="filename1";conststd::stringf2="filename2";conststd::stringf3="filename3";//stringsareusedinthisfil

c++ - 为什么在 C++ 中将 "using namespace"包含到头文件中是个坏主意?

在阅读BruceEckel关于命名空间的“ThinkinginC++”时,我遇到了以下陈述:Howeveryou'llvirtuallyneverseeausingdirectiveinaheaderfile(atleastnotoutsideofscope).Thereasonisthatusingdirectiveeliminatetheprotectionofthatparticularnamespace,andtheeffectlastuntiltheendofcurrentcompilationunit.Ifyouputausingdirective(outsideofasc

c++ - g++ 错误 : ‘stricmp’ was not declared in this scope (but OK for 'strcmp' )

我正在尝试编译以下非常非常简单的源代码:#include//#include//usingnamespacestd;classHelper{public:intcStringsAreEqual(constchar*s1,constchar*s2){returnstricmp(s1,s2);}};...但我收到以下错误消息:g++error:‘stricmp’wasnotdeclaredinthisscope但是,当我使用strcmp()而不是stricmp()时,一切都很好!这里有什么问题?允许strcmp()的时候不应该允许stricmp()吗?Sureley,这一切都可以在不使用s

c++ - 错误 : 'INT32_MAX' was not declared in this scope

我收到了错误error:'INT32_MAX'wasnotdeclaredinthisscope但是我已经收录了#include我正在使用命令在(g++(GCC)4.1.220080704(RedHat4.1.2-44)上编译它g++-m64-O3blah.cpp我需要做任何其他事情来编译它吗?还是有另一种C++方法来获取常量“INT32_MAX”?谢谢,如果有什么不清楚的地方请告诉我! 最佳答案 引自手册页,“只有在包含__STDC_LIMIT_MACROS之前定义时,C++实现才应定义这些宏”。那就试试吧:#define__ST

c++ - 我可以撤消 C++ 中 "using namespace"的影响吗?

使用usingnamespace我使该命名空间的全部内容直接可见,而无需使用命名空间限定符。如果usingnamespace出现在广泛使用的header中,这可能会导致问题-我们可能会无意中使两个具有相同类名的命名空间可见,并且编译器将拒绝编译,除非类名前面带有命名空间限定符。我可以撤消usingnamespace以使编译器忘记它之前看到的吗? 最佳答案 不,但您可以告诉您的同事,您永远不应该在标题中包含using指令或声明。 关于c++-我可以撤消C++中"usingnamespace

c++ - shared_ptr 与 scoped_ptr

scoped_ptr不可复制,正在从范围中删除。所以它是一种受限的shared_ptr。因此,除了确实需要限制复制操作的情况外,shared_ptr似乎更好用。因为有时您不知道是否需要创建对象的拷贝。所以问题是:除了上面提到的情况,我们是否认为shared_ptr比scoped_ptr更好(或推荐)使用。scoped_ptr是否比shared_ptr工作得更快,或者它有什么优势?谢谢! 最佳答案 shared_ptr比scoped_ptr更重量级。它需要分配和释放一个引用计数对象以及托管对象,并处理线程安全的引用计数——在我工作的一