
ReflectionNamedType::isBuiltin 함수는 C++의 Reflection API에서 사용되는 함수로, 이름이 지정된 타입이 기본 타입인지 아닌지를 확인하는 함수입니다.
기본 타입은 C++에서 미리 정의된 타입으로, int, float, char, bool, void 등이 있습니다. 이러한 타입들은 컴파일러가 미리 알기 때문에, Reflection API에서 이러한 타입들을 기본 타입으로 간주합니다.
반면에, std::string, std::vector 등은 사용자 정의 타입으로, 컴파일러가 미리 알지 못하기 때문에 기본 타입이 아닙니다.
이러한 기준은 C++ 표준에서 정의된 타입과 사용자 정의 타입의 차이로 인한 것입니다. Reflection API에서 이러한 차이를 구분하여, 이름이 지정된 타입이 기본 타입인지 아닌지를 확인하는 데 사용됩니다.
예를 들어, int는 기본 타입이므로 ReflectionNamedType::isBuiltin 함수를 호출하면 true를 반환합니다. 반면에, std::string은 사용자 정의 타입이므로 ReflectionNamedType::isBuiltin 함수를 호출하면 false를 반환합니다.
#hostingforum.kr
cpp
#include
#include
#include
int main() {
std::cout << std::boolalpha;
std::cout << std::is_same::value << std::endl; // true
std::cout << std::is_same::value << std::endl; // false
std::cout << std::is_same, std::vector>::value << std::endl; // false
return 0;
}
위의 예제에서, std::is_same 함수를 사용하여 int와 int, std::string과 std::string, std::vector와 std::vector가 같은지 확인합니다. 결과는 true, false, false로 나옵니다.
2025-06-24 17:35