본문 바로가기

Programing/c/c++

람다 샘플 코드2 #include "stdafx.h" #include #include #include using namespace std; class testclass { public: testclass(); ~testclass(); }; int _tmain(int argc, _TCHAR* argv[]) { auto func = [](int n) {cout 더보기
람다 샘플 코드 #include "stdafx.h" #include #include #include using namespace std; function f() { std::string str("abcd"); return [=] { cout 더보기
MECRO 사용. 정의된 MECRO메크로 .....define ##의 사용 http://dhna.tistory.com/44 출처 #define PATHNAME "/Movie/Action" #define MOVIEDATA PATHNAME##"/Data" #, ##, #@ ## 연산자 ## 연산자를 사용해서 토큰을 합성해서 만들어 낼 수 있다. ##은 합치기 연산자 이다. ex) #define MACRO_APPEND(str1, str2) printf("%s\n", str1##str2) # 연산자 # 연산자는 전달된 인자를 문자열로 변환시킨다. ex) #define MACRO_STRING(str) printf("%s\n", #str); #@ 연산자 #@ 연산자는 전달된 인자를 문자로 변환시킨다. 미리 정의된 매크로 __STDC__ : 컴파일러가 ANSI C 표준을 따를 경우 1로 정.. 더보기
char [0] , char [1] 의미? (출처 http://minjang.egloos.com/2254472) 출처 http://minjang.egloos.com/2254472 물론 고수님들에겐 쉬운 문제지만 다음 구조체에서 char data[1]의 역할이 무엇인지 생각 해봅시다. typedef struct tagWHATTHE { int data1; int data2; char data[1]; } WHATTHE; 모르시는 분들은 최소 1분 정도 생각을 해봅시다. 그래도 잘 모르겠으면 약간의 힌트: typedef struct tagWHATTHE { int size; int type; char data[1]; } WHATTHE; char data[1]의 역할은 난생 처음 이런 구조체를 보면 data[1] 변수가 도대체 어떤 의미인지 감을 잡기 힘들다. 왜 이런 변수가 쓰이는지는 직접 예제 코드를 보는 것이 가장 좋을.. 더보기
비쥬얼 스튜디오 스타일 scheme http://studiostyl.es/schemes/wekeroad-ink 더보기