티스토리

구차니의 잡동사니 모음
검색하기

블로그 홈

구차니의 잡동사니 모음

minimonk.net/m

나란히 동등하게 함께

구독자
7
방명록 방문하기
공지 블로그 주인장 장가갑니다 모두보기

주요 글 목록

  • cpp 그래픽 라이브러리 SDL 이라던가 여러가지가 있지만 chatGPT 에서 추천해주는 좀 쉬워보이는 녀석들 목록 [링크 : https://libcinder.org/][링크 : https://openframeworks.cc/] 공감수 0 댓글수 0 2025. 4. 22.
  • cpp 기본 인자 prototype 디폴트 매개변수 라고 하는데프로토타입에다가 해당 변수에 기본 값을 넣어주면 된다.함수 선언이 아님! [링크 : https://code-studies.tistory.com/32] 공감수 0 댓글수 0 2025. 3. 28.
  • cpp std::to_string(int) 자동 형변환(?)은 지원안하는지문자열 끝에 "blah blah : " + value 하니 에러가 발생해서 찾아보니std::to_string() 이라는 착한 녀석이 존재함을 발견! [링크 : https://en.cppreference.com/w/cpp/string/basic_string/to_string][링크 : https://developer-cat.tistory.com/19] 공감수 0 댓글수 0 2025. 2. 20.
  • cpp string 끝에 한글자 지우기 C++11 에 추가std::string::pop_back()[링크 : https://www.techiedelight.com/ko/remove-last-character-end-string-cpp/][[링크 : https://cplusplus.com/reference/string/string/pop_back/] 공감수 0 댓글수 0 2025. 2. 6.
  • cpp stoi (atoi) std::string() 객체를 숫자로 바꾸어 주는 함수c의 atoi 처럼 stoi stof 등이 존재한다. [링크 : https://blockdmask.tistory.com/333][링크 : https://en.cppreference.com/w/cpp/string/basic_string/stol] 공감수 0 댓글수 0 2025. 2. 6.
  • std::string:npos 문자열의 끝까지를 의미하는 unsigned -1 값std::string::find() 시에도 찾지 못하면 npos 값으로 -1을 리턴한다. [링크 : https://cplusplus.com/reference/string/string/npos/] 공감수 0 댓글수 0 2025. 2. 5.
  • std::istringstream 간단하게 요약하면 공백으로 구분하는 토크나이저[링크 : https://myprivatestudy.tistory.com/48] [링크 : https://en.cppreference.com/w/cpp/io/basic_istringstream][링크 : https://cplusplus.com/reference/sstream/istringstream/] 아래를 inlcude 안해주면 먼가 희한한 에러가 발생한다.#include [링크 : https://stackoverflow.com/questions/10882376/stdstringstream-does-not-name-a-type-global] 공감수 0 댓글수 0 2025. 1. 31.
  • cpp destructor = default [링크 : https://stackoverflow.com/questions/13576055/how-is-default-different-from-for-default-constructor-and-destructor][링크 : https://andreasfertig.com/blog/2022/03/a-destructor-default-and-the-move-operations/] c++11 에 추가된 키워드 인 듯. 꽤 오래되긴 했네..다만 생성자나 소멸자에 사용할 경우 객체 생성보다는 기본 객체를 포인터로 연결하는 얕은 복사를 사용한다는 의미일 듯.반대는 delete 키워드로 기본 지정을 막을 수 있는 듯.[링크 : https://woo-dev.tistory.com/100] 공감수 0 댓글수 0 2025. 1. 16.
  • RAII (Resource Acquisition Is Initialization) 개체 수명 및 리소스 관리[링크 : https://news.hada.io/topic?id=17982][링크 : https://learn.microsoft.com/ko-kr/cpp/cpp/object-lifetime-and-resource-management-modern-cpp?view=msvc-170][링크 : https://nx006.tistory.com/40] 공감수 0 댓글수 0 2024. 11. 28.
  • cpp lambda 왜 갑자기 배열이 나와 하면서먼가 희한한 문법이 보이길래 찾아보니 이게 c++ 에서의 람다라고..도대체 람다는 왜 쓰는걸까?#include  #include  void abssort(float* x, unsigned n) {     std::sort(x, x + n,         // Lambda expression begins         [](float a, float b) {             return (std::abs(a)         } // end of lambda expression     ); }[링크 : https://learn.microsoft.com/ko-kr/cpp/cpp/lambda-expressions-in-cpp?view=msvc-170] +2025.01.31리턴타.. 공감수 0 댓글수 0 2024. 11. 22.
  • cpp static_cast<type> cpp랑은 안친하다 보니.. 그나저나 템플릿을 저런식으로도 쓰나 싶긴 한데.. static_cast, dynamic_cast, reinterpret_cast, const_cast [링크 : https://blockdmask.tistory.com/236] [링크 : https://hwan-shell.tistory.com/211] 표준 C++에서는 변환의 안전성을 보장하기 위해 런타임 형식 검사가 수행되지 않습니다. C++/CX에서는 컴파일 시간 및 런타임 검사가 수행됩니다. [링크 : https://learn.microsoft.com/ko-kr/cpp/cpp/static-cast-operator?view=msvc-170] 캐스트 연산자에는 C++ 언어 전용 연산자가 몇 가지 있습니다. 이 연산자는 예전 스.. 공감수 0 댓글수 0 2023. 2. 9.
  • ::open() QT에서 QSeialPort.open() 이 있고 QSerialPort를 상속받은 클래스에서 open()을 하면 자동으로 부모인 QSeialPort.open() 를 호출하게 되는데 CPP가 아닌 C의 fnctl.h의 open()을 열고 싶으면 ::open()을 하면 되...나? [링크 : https://stackoverflow.com/questions/10772169/calling-same-name-function] 공감수 0 댓글수 0 2021. 11. 10.
  • vector 값 비우기 아래의 함수가 가장 눈에 잘 들어 오는 듯? fill(vec.begin(), vec.end(), value); [링크 : https://hini7.tistory.com/66] 공감수 0 댓글수 0 2021. 10. 2.
  • cpp 부모타입으로 업 캐스팅 된 객체의 원래 클래스 알기 dynamic_cast() 를 통해 변환해보면 원래 타입을 알 수 있음. [링크 : https://stackoverflow.com/questions/307765/how-do-i-check-if-an-objects-type-is-a-particular-subclass-in-c] + 해보니 완벽하게 탐지하지는 못하는 듯.. 공감수 0 댓글수 0 2021. 9. 30.
  • cpp string 관련 파싱, tokenizer [링크 :https://psychoria.tistory.com/666] [링크 : https://stackoverflow.com/questions/53849/how-do-i-tokenize-a-string-in-c] string을 숫자로 [링크 : http://yotop93.blogspot.com/2015/04/string.html] 문자열 자르기 -1 식으로 끝에서 자르는건 안되는 듯 [링크 : http://www.cplusplus.com/reference/string/string/substr/] 공감수 0 댓글수 0 2019. 6. 10.
  • cpp stringstream << 연산자 어떻게 보면.. scanf를 좀 편리하게 해주는 cpp용 연산자라고 보면 되려나? [링크 : http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/] string str_sensor_data(mesg); stringstream stream(str_sensor_data); for(int i=0;i> sensor_data[i]; } [링크 : http://youngmok.com/udp-server-c-class-listening-thread/] 공감수 0 댓글수 0 2019. 5. 24.
  • c++ 함수 인자 기본값 정작 써본건 처음이라..아무튼 이녀석은 오른쪽 부터 기본값을 정할 수 있고값이 없으면 기본값이 들어간다. 그런데 함수 prototype에 없는거지함수 선언에 넣으면 아래와 같이 재정의 되었다고 배를 짼다. error C2572: 'CtestDlg::sender' : 기본 매개 변수 재정의. 매개 변수 9'CtestDlg::sender' 선언을 참조하십시오. [링크 : http://shaeod.tistory.com/365] 근데 이게.. msvc 특성인지 gcc나 다른것도 포함하는 표준인지 모르겠네... 공감수 1 댓글수 0 2017. 11. 8.
  • cpp string compare 와 == cpp에서는 string 형 변수일 경우 ==를 compare로 묶어놔서둘이 같은거다 라는건가? [링크 : http://stackoverflow.com/questions/9158894/differences-between-c-string-and-compare][링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/e4abh74z(v=vs.80).aspx] 공감수 0 댓글수 0 2017. 1. 31.
  • cpp this [링크 : http://www.learncpp.com/cpp-tutorial/8-8-the-hidden-this-pointer/] 문득 this를 쓰면 잘못된게 아닐까? 라는 생각문법으로도 지원하는 자기자신을 의미하지만크게 쓸 의미도 없고 (명시적으로 표기한다면야 머...)굳이 명시적으로 써야할 멤버 함수 인자의 명칭과 클래스 멤버 변수가 충돌할경우? [링크 : http://stackoverflow.com/questions/6779645/use-of-this-keyword-in-c][링크 : http://stackoverflow.com/questions/2337540/when-should-you-use-the-this-keyword-in-c] 공감수 0 댓글수 0 2016. 7. 18.
  • class 기본 접근제한자 말은 거창한데.. 결론class 내에 기본적으로 모든 유형에 대해서 private:로 설정됨 [링크 : http://www.cplusplus.com/doc/tutorial/classes/] 근데 이런것도 정리 안해놧었나 -ㅁ-?!?!?? 공감수 0 댓글수 0 2016. 7. 18.
  • cpp 매크로 __PRETTY_FUNCTION__ __FUNC__는 매크로에서 지원하는 함수명 출력명인데..클래스를 포함하려면 비표준이지만(gcc/clagn)__PRETTY_FUNCTION__를 쓰면 클래스:함수명 이렇게 나온다고 한다. [링크 : http://stackoverflow.com/questions/11988895/g-function-on-methods-with-class-name] $ cat func.cpp#include using namespace std; class AAA{public: int a; int get(); int set(int val);}; int AAA::get(){ cout 공감수 0 댓글수 0 2016. 7. 18.
  • cpp dlopen / gcc -l dlopen은 c 시절의 녀석이라 class 자체를 끌어올수는 없다.[링크 : http://www.joinc.co.kr/w/Site/C++/Documents/Dynamic_Class_Loading] 다만.. gcc 에서 컴파일시 -l 링커이름으로 주면 바로 사용가능[링크 : http://stackoverflow.com/questions/58058/using-c-classes-in-so-libraries] 근데 문득.. 둘다 so인데dlopen과 -l을 통한것의 차이를 모르겠네? 공감수 0 댓글수 0 2016. 7. 12.
  • cpp thread.... / pthread 아.. 어렵다 ㅠㅠ 쓰레드 join()[링크 : http://arer.tistory.com/45][링크 : http://linux.die.net/man/3/pthread_cond_wait][링크 : http://linux.die.net/man/3/pthread_join][링크 : http://www.joinc.co.kr/w/Site/Thread/Beginning/PthreadApiReference#AEN144][링크 : http://www.joinc.co.kr/w/man/3/pthread_create] main()이 return 0;로 되어도쓰레드가 종료 되기 전에는 main()이 못 죽는 신기한 현상? 이라고 해야하려나? [링크 : http://www.cplusplus.com/reference/thre.. 공감수 0 댓글수 0 2016. 7. 11.
  • 객체지향과 if문? 도대체 객체지향이 머길래 IF를 없앨수 있나 라고 글들을 찾아 보니..객체 타입에 따라서 자동화 되어 버린(?) C로 치면 모델병 미친듯한 if문에서조금은 해방될 수 있다 정도로 이해하면 되려나? 논리 조거식 조차도 없애야 한다는 줄 알았네 ㄷㄷㄷ [링크 : https://kldp.org/node/31629][링크 : http://alankang.tistory.com/249] [링크 : http://silverktk.tistory.com/353][링크 : http://www.gpgstudy.com/forum/viewtopic.php?t=7803] 공감수 0 댓글수 0 2016. 7. 11.
  • cpp 클래스 구성 좋은 내용들이 있어서 저장Shape::Shape (const Point center,const int color){_center = center;_color = color;} Shape::Shape (const Pointer center,const int color): _center(center), _color (color){} [링크 : http://ogoons.tistory.com/59] 상식을 깨는(!) 초기화를 위해 constructor에 너무 많은걸 넣지 말라라던가(객체 생성시 오버헤드로 인해 초기화 연산자로?)등등? 공감수 0 댓글수 0 2016. 7. 11.
  • cpp enum in class cpp이랑은 안친한데 크윽 ㅠㅠ컴파일러나 Cxx 적용 버전의 차이겠지만 $ g++ --versiong++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3Copyright (C) 2011 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. g++ 4.6.3 에서는 scope 인식을 하긴 하는데 $ cat enum.cpp#include class A{public: int a; enum { A_1, A_2, A_3 };}; cl.. 공감수 0 댓글수 0 2016. 7. 1.
  • cpp const 변수들에 붙는건 뻔하지만const가 cpp에서 확장된 내용멤버 함수일때 멤버 변수를 수정하지 못하도록 하는 기능 추가 return_type fuction_name(val ...) const [링크 : http://blog.daum.net/coolprogramming/60] 공감수 0 댓글수 0 2016. 6. 22.
  • const 멤버 변수 초기화(member variable initializer) const 변수들의 경우 생성자(constructor)에서 초기화 불가능 하므로(생성시에 이미 const로 만들어져 수정이 불가하니까)문법적 허용을 위한 우회책으로 initializer 가 존재해야만 한다. class Something{private: int m_value1; double m_value2; char m_value3; public: Something() : m_value1(1), m_value2(2.2), m_value3('c') // directly initialize our member variables { // No need for assignment here } void print() { std::cout 공감수 0 댓글수 0 2016. 6. 22.
  • std::endl '\n' + fflush(stdout) 이라고 하면 되려나? [링크 : http://www.cplusplus.com/reference/ostream/endl/][링크 : http://stackoverflow.com/questions/213907/c-stdendl-vs-n] 공감수 0 댓글수 0 2015. 6. 24.
  • c++ 현변환 연산자(cast operator in c++) static_castdynamic_castreinterpret_castconst_cast c++에서 추가된 형변환 연산자로c의 명시적 형변환은 유사성이 없는 자료간에도 형변환이 되어 논리오류가 발생할 수 있기 때문에이러한 문제를 최소화/억제하기 위해 사용을 하지 않도록 권장하고새로운 형 변환 연산자를 사용하도록 강조한다. [링크 : http://warmz.tistory.com/881] 공감수 0 댓글수 0 2015. 1. 26.
    문의안내
    • 티스토리
    • 로그인
    • 고객센터

    티스토리는 카카오에서 사랑을 담아 만듭니다.

    © Kakao Corp.