* 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
This commit is contained in:
aandrei 2001-11-23 08:06:43 +00:00
parent 1fadda9836
commit ba72e1e935
3 changed files with 30 additions and 16 deletions

View file

@ -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_

View file

@ -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 <class T>
struct Conversion<T, T>
{
enum { exists = 1, exists2Way = 1,sameType = 1 };
enum { exists = 1, exists2Way = 1, sameType = 1 };
};
template <class T>
struct Conversion<void, T>
{
enum { exists = 1, exists2Way = 0,sameType = 0 };
enum { exists = 0, exists2Way = 0, sameType = 0 };
};
template <class T>
struct Conversion<T, void>
{
enum { exists = 1, exists2Way = 0,sameType = 0 };
enum { exists = 1, exists2Way = 0, sameType = 0 };
};
template <>
class Conversion<void, void>
{
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<const U*, const T*>::exists && \
!::Loki::Conversion<const T*, const void*>::sameType)
(::Loki::Conversion<const volatile U*, const volatile T*>::exists && \
!::Loki::Conversion<const volatile T*, const volatile void*>::sameType)
////////////////////////////////////////////////////////////////////////////////
// macro SUPERSUBCLASS
@ -162,11 +162,16 @@ namespace Loki
#define SUPERSUBCLASS_STRICT(T, U) \
(SUPERSUBCLASS(T, U) && \
!::Loki::Conversion<const T, const U>::sameType)
!::Loki::Conversion<const volatile T, const volatile U>::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<void, T>
// (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_

View file

@ -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<TList, T>::Result
// MostDerived<TList, T>::Result
// returns the type in TList that's the most derived from T
////////////////////////////////////////////////////////////////////////////////
@ -724,8 +726,9 @@ namespace Loki
private:
typedef typename MostDerived<Tail, Head>::Result
TheMostDerived;
typedef typename Replace<Tail,
TheMostDerived, Head>::Result L;
typedef typename ReplaceAll<Tail,
TheMostDerived, Head>::Result Temp;
typedef typename DerivedToFront<Temp>::Result L;
public:
typedef Typelist<TheMostDerived, L> 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_