ブースト ライブラリのリソースを使用してオブジェクト タイプをテストする C++ コード例

#include<boost/type_index.hpp>
using namespace std;

template<typename T>
void f(T&& t)
{
    
    
	cout << "---------------" << endl;
	using boost::typeindex::type_id_with_cvr;

	cout << type_id_with_cvr<T>().pretty_name() << endl;
	cout << type_id_with_cvr<decltype(t)>().pretty_name() << endl;
}

int main()
{
    
    
	using boost::typeindex::type_id_with_cvr;
	cout << type_id_with_cvr<decltype(sizeof(3))>().pretty_name() << endl;

	system("pause");
	return 0;
}

おすすめ

転載: blog.csdn.net/zhangzhangkeji/article/details/132984608