为什么std :: type_info不可复制?我可以把它存放在某个地方吗? [英] Why is std::type_info noncopyable? Am I allowed to store it somewhere?

查看:247
本文介绍了为什么std :: type_info不可复制?我可以把它存放在某个地方吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

std :: type_info 类不可复制。这使得难以将其存储在对象中以供以后使用。我应该怎么办?

The std::type_info class is non-copyable. This makes it hard to store it in an object for later use. What should I do?

推荐答案

在C ++ 11中有一个更好的解决方案。一个名为std :: type_index的新的可复制包装器。您需要包含标题typeindex才能使用。

There is a much better solution in C++11. A new copyable wrapper called std::type_index. You need to include header "typeindex" to use it.

这篇关于为什么std :: type_info不可复制?我可以把它存放在某个地方吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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