0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

C++11 or later で typeid 相当を実装するメモ

Posted at

背景

新規アーキテクチャや特殊アーキテクチャで RTTI(runtime time information)が使えない.
(e.g. CUDA のデバイス側コードなど)

でも typeid() っぽいの使いたい...
(std::any っぽいのの実装に役立つ)

方法

RTTI を使わずに Boost.Any を実装する方法
https://melpon.hatenadiary.org/entry/20090514/1242198204

ありがとうございます.

最近だと std::type_info, typeid 相当は TypeIndex 関連にリネームしています.
コアとなる部分はここでしょうか.

あとは type_index あたりソースコード解析すればいけるはずです!

コンパイル時にテンプレートで型文字列や型id つくっているっぽ? :thinking:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?