TypeTraits.hh
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #ifndef RIVET_TypeTraits_HH 00003 #define RIVET_TypeTraits_HH 00004 00005 namespace Rivet { 00006 00007 /// Mechanisms to allow references and pointers to templated types 00008 /// to be distinguished from one another (since C++ doesn't allow 00009 /// partial template specialisation for functions. 00010 /// Traits methods use specialisation of class/struct templates, and 00011 /// some trickery with typedefs and static const integral types (or 00012 /// enums) to implement partial function specialisation as a work-around. 00013 00014 /// @cond INTERNAL 00015 00016 struct RefType { }; 00017 00018 struct PtrType { }; 00019 00020 template <typename T> 00021 struct TypeTraits; 00022 00023 template <typename U> 00024 struct TypeTraits<const U&> { 00025 typedef RefType ArgType; 00026 }; 00027 00028 template <typename U> 00029 struct TypeTraits<const U*> { 00030 typedef PtrType ArgType; 00031 }; 00032 00033 /// @endcond 00034 00035 } 00036 00037 #endif Generated on Wed Oct 7 2015 12:09:15 for The Rivet MC analysis system by ![]() |