やったこと
データ型を確認するために
- type_info
を使ってみます。
確認環境
$ g++ --version
g++ (Homebrew GCC 9.2.0) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
調査
test.cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
int a1;
long int a2;
string a3;
char a4;
vector<int> a5;
cout << typeid(a1).name() << endl;
cout << typeid(a2).name() << endl;
cout << typeid(a3).name() << endl;
cout << typeid(a4).name() << endl;
cout << typeid(a5).name() << endl;
}
出力結果
i
l
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
c
St6vectorIiSaIiEE