C++/CLIの型
今月はC++/CLIに力を入れることにして、先ずは型から。charがSByteだったりlongがInt32だったりするのに違和感がある。C#に毒されているなぁ。(^^;
#include "stdafx.h" using namespace System; int main(array<System::String ^> ^args) { // C#のtypeof(int)はC++/CLIではint::typeid array<Type^>^ types = { bool::typeid, char::typeid, signed char::typeid, unsigned char::typeid, short::typeid, unsigned short::typeid, int::typeid, unsigned int::typeid, long::typeid, unsigned long::typeid, long long int::typeid, unsigned long long int::typeid, float::typeid, double::typeid, long double::typeid, wchar_t::typeid, }; for each (Type^ type in types) { Console::WriteLine(type->ToString()); } return 0; } /* 結果 System.Boolean System.SByte System.SByte System.Byte System.Int16 System.UInt16 System.Int32 System.UInt32 System.Int32 System.UInt32 System.Int64 System.UInt64 System.Single System.Double System.Double System.Char */