C++ 这是g++;还是CLion bug(在CLion中使用Ctrl+;D)?

C++ 这是g++;还是CLion bug(在CLion中使用Ctrl+;D)?,c++,g++,clion,C++,G++,Clion,关于使用以下代码 #include <iostream> #include <vector> #include <string> int main() { std::vector<std::string> vec; std::string temp{}; while(std::cin >> temp) vec.push_back(temp); std::cout << "\n[ " &l

关于使用以下代码

#include <iostream>
#include <vector>
#include <string>

int main()
{

    std::vector<std::string> vec;
    std::string temp{};
    while(std::cin >> temp) vec.push_back(temp);

    std::cout << "\n[ " << vec[0];
    for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
    std::cout << "]";

}
我明白了

我正在ubuntu上使用CLion和

asmmo@asmmo:~$ g++ --version
g++ (Ubuntu 9.3.0-8ubuntu1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
我用
std=-s++1z
c++2a

考虑到评论,我将代码更新为

#include <iostream>
#include <vector>
#include <string>
#include <thread>
using namespace std::chrono_literals;
int main()
{

    std::vector<std::string> vec;
    std::string temp{};
    while(std::cin >> temp) vec.push_back(temp);
    std::cout<<vec.size();
    std::this_thread::sleep_for(10s);
    std::cout << "\n[ " << vec[0];
    for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
    std::cout << "]";

}

但是它没有显示任何东西,只显示了错误

我的心理猜测是,这是CLion如何向程序提交输入的问题

我可以为您禁用keycaps⌘+D和Ctrl-D,并依赖于“发送EOF”操作或⌘-在禁用Clion键帽的情况下按D键和Ctrl-D键,结果是一样的:程序不接收EOF,但接收某种终止信号

显然,有些人找到了一种方法来规避这个问题:

禁用注册表中的run.processs.with.pty(通过查找操作打开)通常会有所帮助


我从来都不理解Jetbrains工具的炒作…

也许,在
std::cout@ThomasSablik中输出之前,我在更新中就是这么做的。大小不可能是displayed@asmmo使用std::cout@ThomasSablik@ThomasSablik可能是clion中的一个bug。我使用了终端,一切正常。
asmmo@asmmo:~$ g++ --version
g++ (Ubuntu 9.3.0-8ubuntu1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#include <iostream>
#include <vector>
#include <string>
#include <thread>
using namespace std::chrono_literals;
int main()
{

    std::vector<std::string> vec;
    std::string temp{};
    while(std::cin >> temp) vec.push_back(temp);
    std::cout<<vec.size();
    std::this_thread::sleep_for(10s);
    std::cout << "\n[ " << vec[0];
    for(int i {1}; i < vec.size(); i++) std::cout << ", " << vec[i];
    std::cout << "]";

}
kjjkj jkh 555 ^D