First public contribution.
1 // (C) Copyright Gennadiy Rozental 2005.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
8 // File : $RCSfile: rtti.hpp,v $
10 // Version : $Revision: 1.2 $
12 // Description : simple facilities for accessing type information at runtime
13 // ***************************************************************************
15 #ifndef BOOST_TEST_RTTI_HPP_062604GER
16 #define BOOST_TEST_RTTI_HPP_062604GER
24 // ************************************************************************** //
25 // ************** rtti::type_id ************** //
26 // ************************************************************************** //
28 typedef std::ptrdiff_t id_t;
30 namespace rtti_detail {
34 static id_t id() { return reinterpret_cast<id_t>( &inst() ); }
39 static rttid const& inst() { static rttid s_inst; return s_inst; }
42 } // namespace rtti_detail
44 //____________________________________________________________________________//
50 return rtti_detail::rttid_holder<T>::id();
53 //____________________________________________________________________________//
55 #define BOOST_RTTI_SWITCH( type_id_ ) if( ::boost::rtti::id_t switch_by_id = type_id_ )
56 #define BOOST_RTTI_CASE( type ) if( switch_by_id == ::boost::rtti::type_id<type>() )
58 //____________________________________________________________________________//
64 // ************************************************************************** //
68 // Revision 1.2 2005/05/15 06:45:32 rogeeff
69 // *** empty log message ***
71 // Revision 1.1 2005/04/12 06:48:12 rogeeff
72 // Runtime.Param library initial commit
74 // ************************************************************************** //
76 #endif // BOOST_RT_RTTI_HPP_062604GER