⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inheritance_tree.cpp

📁 ACE自适配通信环境(ADAPTIVE Communication Environment)是可以自由使用、开放源码的面向对象(OO)框架(Framework)
💻 CPP
字号:
// file      : Example/Introspection/InheritanceTree/inheritance_tree.cpp// author    : Boris Kolpackov <boris@kolpackov.net>// copyright : Copyright (c) 2002-2003 Boris Kolpackov// license   : http://kolpackov.net/license.html// Note: This example is by no means complete. In fact properly printing// arbitrary C++ inheritance tree is a non-trivial task. If you would like// to improve this example please feel free to send your results back ;-).//#include "Hierarchy.hpp"#include <set>#include <iostream>using std::endl;typedefstd::set<TypeId>TypeIdSet;voidprint_inheritance_tree_core (std::ostream& os,                             TypeInfo const& ti,                             TypeIdSet& set){  bool nl = false;  for (TypeInfo::BaseIterator i = ti.begin_base ();       i != ti.end_base ();       i++)  {    TypeId tid (i->type_info ().type_id ());    if (set.find (tid) != set.end ()) continue;    nl = true;    set.insert (tid);    print_inheritance_tree_core (os, i->type_info (), set);  }  if (nl) os << endl;  os << ti.type_id () << "  ";}voidprint_inheritance_tree (std::ostream& os, TypeInfo const& ti){  TypeIdSet set;  print_inheritance_tree_core (os, ti, set);  os << endl;}intmain (){  B* b  = new D;  print_inheritance_tree (std::cout, b->type_info ());  delete b;}//inheritance_tree.cpp,v 1.1 2005/05/24 04:33:12 turkaye Exp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -