Oncaphillis::niftyLib

niftyLib::UTIL Namespace Reference


Detailed Description

Templates for basic compile-time decisions.

We provide the basic boolean operations like not, or, and, xor. All of these boolean template structs inherit eiher from bool_true_expression or bool_false_expression depending on their (set of) template arguments. So they all provide an enum type with the three entries:

Example:

      UTLL::bool_or<false,true>::value;   // defaults to true
      UTIL::bool_and<false,true>::value;  // defaults to false
      UTIL::bool_xor<false,true>::value;  // defaults to true
      UTIL::bool_not<false>::value;       // defaults to true

      // Declare the foo template class with a
      // bool template argument
      template< bool _B>
      class foo;
      
      // specialize two different foo<bool> instances which either
      // inherit from class bar or foobar
      template<>
      class foo<true> : public bar {
       ...
      };

      template<>
      class foo<false> : public foobar {
       ...
      };

      // Declare anoher class which
      // employs the <b>template bool structs</b> to
      // find out from which foo to inherit

      template<class iCharT,class xCharT>
      class my_class : public foo< bool_and<same_type<iCharT,xCharT>::yes,std::tr1::is_const<iCharT>::value > {
       ...
      };

Furhermore the UTIL namespace provides conditional type modifications.

Example:

      UTIL::conditional_const<int,true>::type;  // becomes const int
      UTIL::conditional_const<int,false>::type; // becomes int


Data Structures

struct  bool_true_expression
 Base class for all true boolean template structs of the UTIL namespace. More...
struct  bool_false_expression
 Base class for all boolean template structs that default to false. More...
struct  bool_expression
 Most generic bool_expression. More...
struct  bool_expression< true >
 bool_expression specialization for _B==true. More...
struct  bool_and
struct  bool_and< true, true >
struct  bool_or
struct  bool_or< false, false >
struct  bool_not
struct  bool_not< false >
struct  bool_xor
struct  is_const_ptr
struct  is_const_ptr< const _T * >
struct  is_const_ref
struct  is_const_ref< const _T & >
struct  same_type
 Determine at compile time if two types are identical. More...
struct  is_const
 is_const uses the is_const type_traits from the BOOST library and expands it with our {yes, no} nomenclature. More...
struct  is_ptr_to_const
struct  is_ptr_to_const< _T const * >
struct  is_ptr_to_const< _T const *const >
struct  conditional_const< _T, false, false >
struct  conditional_const< _T, true, false >
struct  conditional_ptr_to_const< _T, false, false >
struct  conditional_ptr_to_const< _T, true, false >
struct  conditional_ref_to_const< _T, false, false >
struct  conditional_ref_to_const< _T, true, false >


Generated by  doxygen
© 2008; Dr. Sebastian Kloska ( Oncaphillis )
Powered by: [?]