type_opers.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002     
00003     type_opers.hpp -- Operation with types.
00004 
00005     This file is part of the Arageli library.
00006 
00007     Copyright (C) Nikolai Yu. Zolotykh, 1999--2006
00008     Copyright (C) Sergey S. Lyalin, 2005--2006
00009     University of Nizhni Novgorod, Russia
00010 
00011 *****************************************************************************/
00012 
00021 #ifndef _ARAGELI_type_opers_hpp_
00022 #define _ARAGELI_type_opers_hpp_
00023 
00024 
00025 #include "config.hpp"
00026 
00027 #include <iostream>
00028 
00029 
00030 //****************************************************************************
00031 
00032 
00033 namespace Arageli
00034 {
00035 
00036 
00038 
00040 
00041 struct true_type { static const bool value = true; };
00042 struct false_type { static const bool value = false; };
00043 
00044 template <bool V> struct bool_type;
00045 
00046 template <> struct bool_type<false>
00047 {
00048     typedef false_type type;
00049     typedef false_type value_type;
00050     static const false_type value;
00051 };
00052 
00053 
00054 template <> struct bool_type<true>
00055 {
00056     typedef true_type type;
00057     typedef true_type value_type;
00058     static const true_type value;
00059 };
00060 
00061 
00062 inline std::ostream& operator<< (std::ostream& out, const true_type&)
00063 { return out << "true"; }
00064 
00065 inline std::ostream& operator<< (std::ostream& out, const false_type&)
00066 { return out << "false"; }
00067 
00068 
00070 
00071 
00073 
00076 
00078 template <typename T1, typename T2>
00079 struct equal_types
00080 {
00081     static const bool bvalue = false;
00082     typedef false_type value_type;
00083     static const false_type value;
00084 };
00085 
00087 template <typename T>
00088 struct equal_types<T, T>
00089 {
00090     static const bool bvalue = true;
00091     typedef true_type value_type;
00092     static const true_type value;
00093 };
00094 
00096 
00097 
00099 
00103 
00105 template <typename T>
00106 struct omit_const { typedef T type; };
00107 
00109 template <typename T>
00110 struct omit_const<const T> { typedef T type; };
00111 
00113 
00114 
00116 
00119 
00121 template <typename T>
00122 struct omit_asterisk { typedef T type; };
00123 
00125 template <typename T>
00126 struct omit_asterisk<T*> { typedef T type; };
00127 
00129 
00130 
00131 
00133 
00136 
00138 template <typename T>
00139 struct omit_ref { typedef T type; };
00140 
00142 template <typename T>
00143 struct omit_ref<T&> { typedef T type; };
00144 
00146 
00147 
00149 
00150 template <typename T>
00151 struct omit_const_ref
00152 { typedef typename omit_const<typename omit_ref<T>::type>::type type; };
00153 
00154 
00155 //namespace _Internal
00156 //{
00157 //
00158 //template <typename T1, typename T2>
00159 //struct is_subclass_of_helper;
00160 //
00161 //template <typename T1, typename T2>
00162 //struct is_subclass_of_helper;
00163 //
00164 //}
00165 //
00166 //
00169 //template <typename T1, typename T2>
00170 //struct is_subclass_of :
00171 //  public _Internal::is_subclass_of_helper<T1*, T2*> {};
00172 //
00173 
00174 
00177 //  See function_traits and type_traits. */
00178 //template <typename T1, typename T2>
00179 //struct is_subcategory_of
00180 //{
00181 //  static const bool bvalue = false;
00182 //  typedef false_type value_type;
00183 //  static const false_type value;
00184 //};
00185 
00186 
00187 
00188 } // namespace Arageli
00189 
00190 
00191 
00192 #ifdef ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE
00193     #define ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE_TYPE_OPERS
00194     #include "type_opers.cpp"
00195     #undef  ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE_TYPE_OPERS
00196 #endif
00197 
00198 
00199 #endif  //  #ifndef _ARAGELI_type_opers_hpp_

Generated on Thu Aug 31 17:38:12 2006 for Arageli by  doxygen 1.4.7