From ba72e1e9353ee6a422a3a919540b6d7cc6c48c8a Mon Sep 17 00:00:00 2001 From: aandrei Date: Fri, 23 Nov 2001 08:06:43 +0000 Subject: [PATCH] * Fixed a couple of bugs in TypeManip.h * Minor changes to TypeTraits.h and NullType.h for easying migration to boost. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@8 7ec92016-0320-0410-acc4-a06ded1c099a --- NullType.h | 5 +++-- TypeManip.h | 25 +++++++++++++++---------- Typelist.h | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/NullType.h b/NullType.h index c599315..3537c4d 100644 --- a/NullType.h +++ b/NullType.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: June 20, 2001 +// Last update: November 22, 2001 #ifndef NULLTYPE_INC_ #define NULLTYPE_INC_ @@ -27,11 +27,12 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// class NullType {}; -} +} // namespace Loki //////////////////////////////////////////////////////////////////////////////// // Change log: // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +// November 22, 2001: minor change to support porting to boost //////////////////////////////////////////////////////////////////////////////// #endif // NULLTYPE_INC_ diff --git a/TypeManip.h b/TypeManip.h index 64eace9..931c8ab 100644 --- a/TypeManip.h +++ b/TypeManip.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: June 20, 2001 +// Last update: November 22, 2001 #ifndef TYPEMANIP_INC_ #define TYPEMANIP_INC_ @@ -116,28 +116,28 @@ namespace Loki template struct Conversion { - enum { exists = 1, exists2Way = 1,sameType = 1 }; + enum { exists = 1, exists2Way = 1, sameType = 1 }; }; template struct Conversion { - enum { exists = 1, exists2Way = 0,sameType = 0 }; + enum { exists = 0, exists2Way = 0, sameType = 0 }; }; template struct Conversion { - enum { exists = 1, exists2Way = 0,sameType = 0 }; + enum { exists = 1, exists2Way = 0, sameType = 0 }; }; template <> class Conversion { public: - enum { exists = 1, exists2Way = 1,sameType = 1 }; - }; -} + enum { exists = 1, exists2Way = 1, sameType = 1 }; + }; +} // namespace Loki //////////////////////////////////////////////////////////////////////////////// // macro SUPERSUBCLASS @@ -149,8 +149,8 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// #define SUPERSUBCLASS(T, U) \ - (::Loki::Conversion::exists && \ - !::Loki::Conversion::sameType) + (::Loki::Conversion::exists && \ + !::Loki::Conversion::sameType) //////////////////////////////////////////////////////////////////////////////// // macro SUPERSUBCLASS @@ -162,11 +162,16 @@ namespace Loki #define SUPERSUBCLASS_STRICT(T, U) \ (SUPERSUBCLASS(T, U) && \ - !::Loki::Conversion::sameType) + !::Loki::Conversion::sameType) //////////////////////////////////////////////////////////////////////////////// // Change log: // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +// November 22, 2001: minor change to support porting to boost +// November 22, 2001: fixed bug in Conversion +// (credit due to Brad Town) +// November 23, 2001: (well it's 12:01 am) fixed bug in SUPERSUBCLASS - added +// the volatile qualifier to be 100% politically correct //////////////////////////////////////////////////////////////////////////////// #endif // TYPEMANIP_INC_ diff --git a/Typelist.h b/Typelist.h index ea65f2f..1777b8e 100644 --- a/Typelist.h +++ b/Typelist.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: June 20, 2001 +// Last update: November 22, 2001 #ifndef TYPELIST_INC_ #define TYPELIST_INC_ @@ -365,6 +365,8 @@ namespace Loki typedef U Tail; }; +// Typelist utility algorithms + namespace TL { //////////////////////////////////////////////////////////////////////////////// @@ -679,7 +681,7 @@ namespace Loki // class template MostDerived // Finds the type in a typelist that is the most derived from a given type // Invocation (TList is a typelist, T is a type): -// Replace::Result +// MostDerived::Result // returns the type in TList that's the most derived from T //////////////////////////////////////////////////////////////////////////////// @@ -724,8 +726,9 @@ namespace Loki private: typedef typename MostDerived::Result TheMostDerived; - typedef typename Replace::Result L; + typedef typename ReplaceAll::Result Temp; + typedef typename DerivedToFront::Result L; public: typedef Typelist Result; }; @@ -738,6 +741,11 @@ namespace Loki // June 09, 2001: Fix bug in parameter list of macros TYPELIST_23 to TYPELIST_27 // (credit due to Dave Taylor) // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +// November 22, 2001: fixed bug in DerivedToFront +// (credit due to Gianni Luciani who noticed the bug first; +// Adam Wilkshire; +// Friedrik Hedman who fixed the bug but didn't send the fix; +// Kevin Cline who sent the first actual fix) //////////////////////////////////////////////////////////////////////////////// #endif // TYPELIST_INC_