我试图让cout缓冲区刷新以在我操作之前查看字符串.我试图通过调用两者来刷新缓冲区,但实际上std::flush()并std::cout.flush()没有刷新我的输出.
只有一个调用std::endl已经为我成功刷新了缓冲区.
这是我的代码
std::istringstream stm (game.date());
int day, month, year;
char delim = '/';
std::cout << "Date before: " << game.date() << std::flush; // first flush attempt
std::cout.flush(); // second flush attempt doesnt work
//std::cout << std::endl; // if this is executed the buffer will flush
// Split date string into integers for comparison
stm >> month >> delim;
stm >> day >> delim;
stm >> year >> delim;
std::cout << "Date after: " …Run Code Online (Sandbox Code Playgroud) 我有一个react-native SectionList,在视图中包含多个FlatLists.当用户触摸底部FlatList中的一个元素时,上面的一些FlatLists将加载新数据,从而导致用户的当前视图被推高.换句话说,用户的y位置保持不变,但先前在视图中的内容现在具有更大的y位置.
在添加上面其他FlatLists中的元素之前,如何让用户的y位置与他们在视图中的元素保持同步?