ios::sync_with_stdio(false); あなたは誰ですか.
C++でよく見かけるこいつ
ios::sync_with_stdio(false);使用理由は
これはcppのiostreamをcのstdioと同期させるためである.
その違いを見てみましょう.
まず,ios::sync with stdio(false);使用しない場合は 🤷入力 ios::sync_with_stdio(false); 🤷入力
すなわち、後者はstdioとiostreamの同期を実行しない.
c++のみ独立したバッファを使用し、cと同時に使用できません.
バッファの速度が低下し、実行速度が向上します.
ただし、マルチスレッド環境では出力順序は保証されません.
n/a.結論
アルゴリズムはほぼ単一スレッド環境で実行される.
ios::sync_with_stdio(false);使うといいですね!
#include<iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
return 0;
}
何でも知って使ってください.ios::sync_with_stdio(false);使用理由は
これはcppのiostreamをcのstdioと同期させるためである.
その違いを見てみましょう.
まず
#include <iostream>
using namespace std;
int main(){
ios::sync_with_stdio(true); // 디폴트임ㄴ
cout << "야";
printf("외");
cout<<"수영장";
}
🤷♂️しゅつりょく야외수영장
#include <iostream>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cout << "야";
printf("외");
cout<<"수영장";
}
🤷♂️しゅつりょく외야수영장
前者は順番に出力され,後者はそうではないことがわかる.すなわち、後者はstdioとiostreamの同期を実行しない.
c++のみ独立したバッファを使用し、cと同時に使用できません.
バッファの速度が低下し、実行速度が向上します.
ただし、マルチスレッド環境では出力順序は保証されません.
n/a.結論
アルゴリズムはほぼ単一スレッド環境で実行される.
ios::sync_with_stdio(false);使うといいですね!
Reference
この問題について(ios::sync_with_stdio(false); あなたは誰ですか.), 我々は、より多くの情報をここで見つけました https://velog.io/@idwooin/iossyncwithstdiofalse넌-누구냐テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol