애시당초에 아래처럼 무식하게 넣고 있는걸
instance.SetPacketIDMap(eGSL_Error, "eGSL_Error");
instance.SetPacketIDMap(eGSL_Packet_Start, "eGSL_Packet_Start");
...
...
아래와 비슷하게 하면 된다는 것을 알았다.
#define SET_PACKET_NAME(name) \
instance.SetPacketIDMap(name,#name)
아래 #, &name:: , eTcp 이 무슨 의미인지 알아보자.
#define RegisterTcpFlow(name) \
RegisterFlow(#name, &name::Construct); \
위를 define 해놓고, 아래 코드를 실행하면
RegisterTcpFlow(hello)
결과 :
RegisterFlow("hello", &hello::Construct);
You can pass almost anything as argument to a macro, not just variables.
#include <iostream>
#define STR(str) #str
int main()
{
std::cout << STR(This will be turned into a string.\n\t123...);
}
This will be turned into a string.
123...
'Language & etc > C++ Keyword' 카테고리의 다른 글
union (0) | 2022.07.27 |
---|---|
Inline (0) | 2022.05.13 |