找出C ++ Void指针的类型 [英] Find out Type of C++ Void Pointer

查看:118
本文介绍了找出C ++ Void指针的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小问题:我怎么知道什么类型的C ++指针是?

I have a small question: how do I find out what type a C++ pointer is?

我经常在我的控制台程序中使用一个小函数来收集输入,它看起来像这样:

I often use a small function in my console programs to gather input, which looks something like this:

void query(string what-to-ask, [insert datatype here] * input)

我想使用void指针创建一个通用形式, ,所以我怎么知道它的类型,所以我可以施展它?

I would like to create a generic form, using a void pointer, but I can't cin a void pointer, so how to I find out it's type so I can cast it?

推荐答案

以C ++编码,但...

It's been a long time since the last time I coded in C++, but...

不能使用模板

这篇关于找出C ++ Void指针的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆