include/deal.II/base/template_constraints.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: template_constraints.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2012 by the deal.II authors
00005 //
00006 //    This file is subject to QPL and may not be  distributed
00007 //    without copyright and license information. Please refer
00008 //    to the file deal.II/doc/license.html for the  text  and
00009 //    further information on this license.
00010 //
00011 //---------------------------------------------------------------------------
00012 #ifndef __deal2__template_constraints_h
00013 #define __deal2__template_constraints_h
00014 
00015 
00016 #include <deal.II/base/config.h>
00017 
00018 DEAL_II_NAMESPACE_OPEN
00019 
00020 template <bool, typename> struct constraint_and_return_value;
00021 
00022 
00079 template <typename T> struct constraint_and_return_value<true,T>
00080 {
00081     typedef T type;
00082 };
00083 
00084 
00085 #ifdef DEAL_II_SFINAE_BUG
00086 
00094 template <typename T> struct constraint_and_return_value<false,T>
00095 {
00096     typedef T type;
00097 };
00098 
00099 #endif
00100 
00101 
00102 
00154 template <typename T>
00155 struct identity
00156 {
00157     typedef T type;
00158 };
00159 
00160 
00161 
00180 struct PointerComparison
00181 {
00187     template <typename T>
00188     static bool equal (const T *p1, const T *p2);
00189 
00199     template <typename T, typename U>
00200     static bool equal (const T*, const U*);
00201 };
00202 
00203 
00204 
00205 namespace internal
00206 {
00265   template <int N>
00266   struct int2type
00267   {};
00268 
00269 
00275   template <bool B>
00276   struct bool2type
00277   {};
00278 }
00279 
00280 
00281 
00298 template <typename T, typename U>
00299 struct types_are_equal
00300 {
00301     static const bool value = false;
00302 };
00303 
00304 
00310 template <typename T>
00311 struct types_are_equal<T,T>
00312 {
00313     static const bool value = true;
00314 };
00315 
00316 
00317 
00318 // --------------- inline functions -----------------
00319 
00320 
00321 template <typename T, typename U>
00322 inline
00323 bool
00324 PointerComparison::equal (const T*, const U*)
00325 {
00326   return false;
00327 }
00328 
00329 
00330 
00331 template <typename T>
00332 inline
00333 bool
00334 PointerComparison::equal (const T *p1, const T *p2)
00335 {
00336   return (p1==p2);
00337 }
00338 
00339 
00340 
00341 DEAL_II_NAMESPACE_CLOSE
00342 
00343 #endif
00344 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Wed May 23 2012 12:03:21 by doxygen 1.7.3