ADL与当前名称空间中的功能发生冲突
我的命名空间中有一个功能。它的名称是销毁。 std 命名空间还包含 and nofollow noreferrer' 。当我在命名空间中调用我的功能时,调用是模棱两可的,…
std ::有条件参数上的模板功能扣除失败
请,在将其标记为这个问题读取整个帖子 此代码无法编译,并没有模板扣除错误: #include #include template class MyClass { public: template using …
调用C++来自C文件的标准标头(CSTDINT)
我有一个用C ++编写的外部库,例如 external.h #ifndef OUTPUT_FROM_CPP_H #define OUTPUT_FROM_CPP_H #include extern "C" uint8_t myCppFunction(ui…
如何仅读取std :: basic_ostream的某些符号(例如std :: cin)
#include #include #include #include int main () { std::vector words{}; std::string word; char letter; while (std::cin.get(letter) && letter …
C++将无现有元素从一个向量复制到另一个矢量
我有这样的课程: struct DataElement { std::string key; std::string value; std::string placeholder; // some other data members } 我将它们存储…
是否有一种使用方法(std :: cin).get()在要求输入时接受新线?
(std :: cin).get() 我想使用std :: cin收集带有空间的弦,例如“花1/2盎司”。当我添加一个空间然后按Enter IT退出程序时,而不是收集其余的输入…
源自std :: pinitializer_list是合法的吗?
我可以将 std :: prinitizer_list 列表作为基类吗? template struct il : std::initializer_list { using base = std::initializer_list; il(base li…
如何找出std :: vector中是否存在项目?
我要做的就是检查矢量中是否存在一个元素,以便我可以处理每种情况。 if ( item_present ) do_this(); else do_that(); …
如何将已知签名的特定对象存储在C++中的变量中?
在某些对象实例上存储对特定签名的非静态成员函数的引用的推荐方法是什么?在调用代码不知道对象类(即没有铸件)的方式中,该功能是正确的签名。 例…
在这种情况下,为什么STD ::移动原因是Segfault?
为什么在这种情况下 std :: move()导致segfault? #include struct Message { std::string message; }; Message * Message_Init(std::string messag…
“使用命名空间std;&quot”的问题是什么?
我已经听到使用命名空间std; 是错误的,并且我应该使用 std :: cout 和 std :: cin cin 直接而代替。 为什么这是?它是否会宣布与 std 名称空间中的内…
如何使用__cpp_lib_*功能测试宏?
我想使用功能测试宏检查 std :::::::::::::::::: FileSystem 可用,但是即使我知道 std :: filesystem , __ cpp_lib_filesystem 也无法定义。例如,…
到达结束后,如何附加到std :: fstream(std :: fstream :: eof()是真的)
我打开一个这样的文件(因为它是练习的一部分,可能需要覆盖文件): #include //std::fstream. std::fstream file("file.txt", std::ios::in | std::…
关于使用STD :: Numeric_limits< t> :: Infinity()的算术操作
我有一个奇特的用例,其中我的边缘带有最初设置为 std :: numeric_limits< double> :: Infinity()的权重。这些权重将在程序执行中以后设置…
如何在C++中解决此运行时间错误? - “围绕变量的堆栈已损坏”。
我尝试获得 的最小 两个整数,实数, strings ,,和整数数组通过实现获得与功能超载的功能。 所以我写这样的代码 #include #include using namespace…