목록C++ (74)
일상 코딩
#include #include using namespace std; int main() { // c-style 문자랑 다르게 // string은 뒤에 null문자가 포함되지 않음 string my_str("01234567"); // 미리 용량 확보(최소한의 용량) my_str.reserve(1000); cout
#include #include #include #include template std::string ToString( T x) { std::ostringstream osstream; osstream > x) ? true : false; } int main(void) { std::string my_string("my string"); // 0부터 2번 인덱스 글자는 건너뛰고 3번째 인덱스 글자부터 5개 글자 슬라이싱 std::string second_string(my_string,3, 2); std::cout
#include #include #include using namespace std; int main() { // multi-threading { // 스코프를 넓게 잡고, 변수를 여러 쓰레드들이 공유하는 형태가 // 일반적임. int result; std::thread t([&] {result = 1 + 2;}); // thread를 기다리고 있음. t.join(); cout
#include #include #include #include #include #include #include using namespace std; mutex mtx; int main() { // atomic shared memory // atomic shm(0); // mutex condition int shm(0); // lambda function auto count_func = [&](){ for (int i = 0; i < 1000; ++i) { // 어떤 계산이 복잡한 코드가 들어있는 것을 가정한 코드 this_thread::sleep_for(chrono::milliseconds(1)); // mtx.lock(); // std::lock_guard lock(mtx); // lock(), un..
#include #include #include #include #include #include using namespace std; // mutual exclusion (상호 배제) 서로 못 건드림. mutex mtx; int main() { // 코어 개수 확인 cout
#include #include #include using namespace std; tuple my_func() { return tuple(123,456); } auto my_func2() { return tuple(123,456,789,10); } int main(int argc, char const *argv[]) { // tuple result = my_func(); // cout
#include #include #include #include #include void goodbye(const std::string& s) { std::cout
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/c2Ihlw/btrnoCjkEph/6UBWGkuPmIek82UQTiCJsK/img.png)
VSCODE 다운로드 통한 설치 https://code.visualstudio.com/#alt-downloads Visual Studio Code - Code Editing. Redefined Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. code.visualstudio.com VSCODE 터미널 통한 설치 $ sudo apt update $ sudo apt inst..
https://docs.microsoft.com/ko-kr/cpp/cpp/lambda-expressions-in-cpp?view=msvc-170 C++ 람다 식 자세한 정보: C++의 람다 식 docs.microsoft.com
https://www.learncpp.com/ Learn C++ – Skill up with our free tutorials LearnCpp.com is a free website devoted to teaching you how to program in C++. Whether you’ve had any prior programming experience or not, the tutorials on this site will walk you through all the steps to write, compile, and debug your C++ programs, all w www.learncpp.com