Fix various issues related to stability when using highly compliant compilers such as Comeau 4.3.0.1, VC7.1 and GCC 3.2

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@108 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rani_sharoni 2003-02-27 20:09:08 +00:00
parent 80e63b12a3
commit b53b3265e4
56 changed files with 441 additions and 203 deletions

View file

@ -14,6 +14,8 @@
# include "Reference/AbstractFactory.h" # include "Reference/AbstractFactory.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/AbstractFactory.h" # include "Borland/AbstractFactory.h"
# elif (_MSC_VER >= 1301)
# include "Reference/AbstractFactory.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/AbstractFactory.h" # include "MSVC/1300/AbstractFactory.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/AssocVector.h" # include "Reference/AssocVector.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/AssocVector.h" # include "Borland/AssocVector.h"
# elif (_MSC_VER >= 1301)
# include "Reference/AssocVector.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/AssocVector.h" # include "MSVC/1300/AssocVector.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -18,7 +18,7 @@
#ifndef FACTORY_INC_ #ifndef FACTORY_INC_
#define FACTORY_INC_ #define FACTORY_INC_
#include "Loki_TypeInfo.h" #include "LokiTypeInfo.h"
#include "AssocVector.h" #include "AssocVector.h"
#include <exception> #include <exception>

View file

@ -1,26 +1,4 @@
head 1.1; ////////////////////////////////////////////////////////////////////////////////
access;
symbols;
locks; strict;
comment @ * @;
1.1
date 2002.07.16.22.42.05; author tslettebo; state Exp;
branches;
next ;
desc
@@
1.1
log
@Initial commit
@
text
@////////////////////////////////////////////////////////////////////////////////
// The Loki Library // The Loki Library
// Copyright (c) 2001 by Andrei Alexandrescu // Copyright (c) 2001 by Andrei Alexandrescu
// This code accompanies the book: // This code accompanies the book:
@ -35,10 +13,10 @@ text
// without express or implied warranty. // without express or implied warranty.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Last update: June 20, 2001 // Last update: August 9, 2002
#ifndef TYPEINFO_INC_ #ifndef LOKITYPEINFO_INC_
#define TYPEINFO_INC_ #define LOKITYPEINFO_INC_
#include <typeinfo> #include <typeinfo>
#include <cassert> #include <cassert>
@ -54,6 +32,7 @@ namespace Loki
class TypeInfo class TypeInfo
{ {
public: public:
// Constructors // Constructors
TypeInfo(); // needed for containers TypeInfo(); // needed for containers
TypeInfo(const std::type_info&); // non-explicit TypeInfo(const std::type_info&); // non-explicit
@ -123,8 +102,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Change log: // Change log:
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
// July 16, 2002: Ported by Terje Slettebø to BCC 5.6 // July 16, 2002: Ported by Terje Slettebø and Pavel Vozenilek to BCC 5.6
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // TYPEINFO_INC_ #endif // LOKITYPEINFO_INC_
@

View file

@ -19,7 +19,7 @@
#define MULTIMETHODS_INC_ #define MULTIMETHODS_INC_
#include "Typelist.h" #include "Typelist.h"
#include "Loki_TypeInfo.h" //### BCB #include "LokiTypeInfo.h" //### BCB
#include "Functor.h" #include "Functor.h"
#include "AssocVector.h" #include "AssocVector.h"
#include <iostream> // *** #include <iostream> // ***

View file

@ -280,6 +280,9 @@ FixedAllocator::Chunk* FixedAllocator::VicinityFind(void* p)
Chunk* loBound = &chunks_.front(); Chunk* loBound = &chunks_.front();
Chunk* hiBound = &chunks_.back() + 1; Chunk* hiBound = &chunks_.back() + 1;
// Special case: deallocChunk_ is the last in the array
if (hi == hiBound) hi = 0;
for (;;) for (;;)
{ {
if (lo) if (lo)

View file

@ -67,6 +67,27 @@ namespace Loki
typedef U Result; typedef U Result;
}; };
////////////////////////////////////////////////////////////////////////////////
// class template IsSameType
// Return true iff two given types are the same
// Invocation: SameType<T, U>::value
// where:
// T and U are types
// Result evaluates to true iff U == T (types equal)
////////////////////////////////////////////////////////////////////////////////
template <typename T, typename U>
struct IsSameType
{
enum { value = false };
};
template <typename T>
struct IsSameType<T,T>
{
enum { value = true };
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -368,6 +368,47 @@ namespace Loki
namespace TL namespace TL
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template MakeTypelist
// Takes a number of arguments equal to its numeric suffix
// The arguments are type names.
// MakeTypelist<T1, T2, ...>::Result
// returns a typelist that is of T1, T2, ...
////////////////////////////////////////////////////////////////////////////////
template
<
typename T1 = NullType, typename T2 = NullType, typename T3 = NullType,
typename T4 = NullType, typename T5 = NullType, typename T6 = NullType,
typename T7 = NullType, typename T8 = NullType, typename T9 = NullType,
typename T10 = NullType, typename T11 = NullType, typename T12 = NullType,
typename T13 = NullType, typename T14 = NullType, typename T15 = NullType,
typename T16 = NullType, typename T17 = NullType, typename T18 = NullType
>
struct MakeTypelist
{
private:
typedef typename MakeTypelist
<
T2 , T3 , T4 ,
T5 , T6 , T7 ,
T8 , T9 , T10,
T11, T12, T13,
T14, T15, T16,
T17, T18
>
::Result TailResult;
public:
typedef Typelist<T1, TailResult> Result;
};
template<>
struct MakeTypelist<>
{
typedef NullType Result;
};
////////////////////////////////////////////////////////////////////////////////
// class template Length // class template Length
// Computes the length of a typelist // Computes the length of a typelist
// Invocation (TList is a typelist): // Invocation (TList is a typelist):

View file

@ -14,6 +14,8 @@
# include "Reference/DataGenerators.h" # include "Reference/DataGenerators.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/DataGenerators.h" # include "Borland/DataGenerators.h"
# elif (_MSC_VER >= 1301)
# include "Reference/DataGenerators.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/DataGenerators.h" # include "MSVC/1300/DataGenerators.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/EmptyType.h" # include "Reference/EmptyType.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/EmptyType.h" # include "Borland/EmptyType.h"
# elif (_MSC_VER >= 1301)
# include "Reference/EmptyType.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/EmptyType.h" # include "MSVC/1300/EmptyType.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/Factory.h" # include "Reference/Factory.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Factory.h" # include "Borland/Factory.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Factory.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Factory.h" # include "MSVC/1300/Factory.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/Functor.h" # include "Reference/Functor.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Functor.h" # include "Borland/Functor.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Functor.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Functor.h" # include "MSVC/1300/Functor.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/HierarchyGenerators.h" # include "Reference/HierarchyGenerators.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/HierarchyGenerators.h" # include "Borland/HierarchyGenerators.h"
# elif (_MSC_VER >= 1301)
# include "Reference/HierarchyGenerators.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/HierarchyGenerators.h" # include "MSVC/1300/HierarchyGenerators.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -6,19 +6,21 @@
//////////////////////////////// ////////////////////////////////
#ifdef LOKI_USE_REFERENCE #ifdef LOKI_USE_REFERENCE
# include "Reference/TypeInfo.h" # include "Reference/LokiTypeInfo.h"
#else #else
# if (__INTEL_COMPILER) # if (__INTEL_COMPILER)
# include "Reference/TypeInfo.h" # include "Reference/LokiTypeInfo.h"
# elif (__MWERKS__) # elif (__MWERKS__)
# include "Reference/TypeInfo.h" # include "Reference/LokiTypeInfo.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/TypeInfo.h" # include "Borland/LokiTypeInfo.h"
# elif (_MSC_VER >= 1301)
# include "Borland/LokiTypeInfo.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/TypeInfo.h" # include "MSVC/1300/LokiTypeInfo.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)
# include "MSVC/1200/TypeInfo.h" # include "MSVC/1200/LokiTypeInfo.h"
# else # else
# include "Reference/TypeInfo.h" # include "Reference/LokiTypeInfo.h"
# endif # endif
#endif #endif

View file

@ -21,7 +21,7 @@
#ifndef FACTORY_INC_ #ifndef FACTORY_INC_
#define FACTORY_INC_ #define FACTORY_INC_
#include "TypeInfo.h" #include "LokiTypeInfo.h"
#include "AssocVector.h" #include "AssocVector.h"
#include <exception> #include <exception>

View file

@ -15,8 +15,8 @@
// Last update: June 20, 2001 // Last update: June 20, 2001
#ifndef TYPEINFO_INC_ #ifndef LOKITYPEINFO_INC_
#define TYPEINFO_INC_ #define LOKITYPEINFO_INC_
#include <typeinfo> #include <typeinfo>
#include <cassert> #include <cassert>
@ -62,7 +62,7 @@ namespace Loki
inline bool TypeInfo::before(const TypeInfo& rhs) const inline bool TypeInfo::before(const TypeInfo& rhs) const
{ {
assert(pInfo_); assert(pInfo_);
return pInfo_->before(*rhs.pInfo_); return pInfo_->before(*rhs.pInfo_) != 0;
} }
inline const std::type_info& TypeInfo::Get() const inline const std::type_info& TypeInfo::Get() const
@ -80,7 +80,7 @@ namespace Loki
// Comparison operators // Comparison operators
inline bool operator==(const TypeInfo& lhs, const TypeInfo& rhs) inline bool operator==(const TypeInfo& lhs, const TypeInfo& rhs)
{ return lhs.Get() == rhs.Get(); } { return (lhs.Get() == rhs.Get()) != 0; }
inline bool operator<(const TypeInfo& lhs, const TypeInfo& rhs) inline bool operator<(const TypeInfo& lhs, const TypeInfo& rhs)
{ return lhs.before(rhs); } { return lhs.before(rhs); }
@ -103,4 +103,4 @@ namespace Loki
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // TYPEINFO_INC_ #endif // LOKITYPEINFO_INC_

View file

@ -42,7 +42,7 @@
#define MULTIMETHODS_INC_ #define MULTIMETHODS_INC_
#include "Typelist.h" #include "Typelist.h"
#include "TypeInfo.h" #include "LokiTypeInfo.h"
#include "Functor.h" #include "Functor.h"
#include "AssocVector.h" #include "AssocVector.h"

View file

@ -18,7 +18,7 @@
#ifndef FACTORY_INC_ #ifndef FACTORY_INC_
#define FACTORY_INC_ #define FACTORY_INC_
#include "TypeInfo.h" #include "LokiTypeInfo.h"
#include "AssocVector.h" #include "AssocVector.h"
#include <exception> #include <exception>

View file

@ -240,7 +240,7 @@ namespace Loki
typedef typename Select typedef typename Select
< <
SameType<UnitType, TupleUnit<ElementType> >::value, IsSameType<UnitType, TupleUnit<ElementType> >::value,
ElementType, ElementType,
UnitType UnitType
> >
@ -285,7 +285,7 @@ namespace Loki
typedef typename Select typedef typename Select
< <
SameType<UnitType, TupleUnit<ElementType> >::value, IsSameType<UnitType, TupleUnit<ElementType> >::value,
ElementType, ElementType,
UnitType UnitType
> >

View file

@ -15,8 +15,8 @@
// Last update: May 19, 2002 // Last update: May 19, 2002
#ifndef TYPEINFO_INC_ #ifndef LOKITYPEINFO_INC_
#define TYPEINFO_INC_ #define LOKITYPEINFO_INC_
#include <typeinfo> #include <typeinfo>
#include <cassert> #include <cassert>
@ -104,4 +104,4 @@ namespace Loki
// May 10, 2002: ported by Rani Sharoni to VC7 (RTM - 9466) // May 10, 2002: ported by Rani Sharoni to VC7 (RTM - 9466)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // TYPEINFO_INC_ #endif // LOKITYPEINFO_INC_

View file

@ -19,7 +19,7 @@
#define MULTIMETHODS_INC_ #define MULTIMETHODS_INC_
#include "Typelist.h" #include "Typelist.h"
#include "TypeInfo.h" #include "LokiTypeInfo.h"
#include "Functor.h" #include "Functor.h"
#include "AssocVector.h" #include "AssocVector.h"

View file

@ -335,14 +335,10 @@ namespace Loki
class SingletonHolderStaticData class SingletonHolderStaticData
{ {
friend ClientType; // illegal (11.4/2) but works with VC friend ClientType; // illegal (11.4/2) but works with VC
static ThreadingModelType s_ThreadingModelData;
static PtrInstanceType s_pInstance; static PtrInstanceType s_pInstance;
static bool s_destroyed; static bool s_destroyed;
}; };
template<class C, class M, class P>
M SingletonHolderStaticData<C, M, P>::s_ThreadingModelData;
template<class C, class M, class P> template<class C, class M, class P>
P SingletonHolderStaticData<C, M, P>::s_pInstance; P SingletonHolderStaticData<C, M, P>::s_pInstance;
@ -382,9 +378,7 @@ namespace Loki
// Helpers // Helpers
static void MakeInstance() static void MakeInstance()
{ {
typename ThreadingModel<T>::Lock guard( typename ThreadingModel<SingletonHolder>::Lock guard;
MySingletonHolderStaticData::s_ThreadingModelData);
(void)guard; (void)guard;
if (!pInstance_()) if (!pInstance_())

View file

@ -273,6 +273,9 @@ FixedAllocator::Chunk* FixedAllocator::VicinityFind(void* p)
Chunk* loBound = &chunks_.front(); Chunk* loBound = &chunks_.front();
Chunk* hiBound = &chunks_.back() + 1; Chunk* hiBound = &chunks_.back() + 1;
// Special case: deallocChunk_ is the last in the array
if (hi == hiBound) hi = 0;
for (;;) for (;;)
{ {
if (lo) if (lo)

View file

@ -127,20 +127,6 @@ namespace Loki
// allocations/deallocations // allocations/deallocations
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template
<
class ClientType,
class ThreadingModelType
>
class SmallObjectStaticData
{
friend ClientType; // illegal (11.4/2) but works with VC
static ThreadingModelType s_ThreadingModelData;
};
template<class C, class M>
M SmallObjectStaticData<C, M>::s_ThreadingModelData;
template template
< <
template <class> class ThreadingModel = DEFAULT_THREADING, template <class> class ThreadingModel = DEFAULT_THREADING,
@ -153,13 +139,6 @@ namespace Loki
typedef ThreadingModel< SmallObject<ThreadingModel, typedef ThreadingModel< SmallObject<ThreadingModel,
chunkSize, maxSmallObjectSize> > MyThreadingModel; chunkSize, maxSmallObjectSize> > MyThreadingModel;
typedef SmallObjectStaticData
<
SmallObject,
MyThreadingModel
>
MySmallObjectStaticData;
struct MySmallObjAllocator : public SmallObjAllocator struct MySmallObjAllocator : public SmallObjAllocator
{ {
MySmallObjAllocator() MySmallObjAllocator()
@ -175,8 +154,7 @@ namespace Loki
static void* operator new(std::size_t size) static void* operator new(std::size_t size)
{ {
#if (MAX_SMALL_OBJECT_SIZE != 0) && (DEFAULT_CHUNK_SIZE != 0) #if (MAX_SMALL_OBJECT_SIZE != 0) && (DEFAULT_CHUNK_SIZE != 0)
typename MyThreadingModel::Lock lock( typename MyThreadingModel::Lock lock;
MySmallObjectStaticData::s_ThreadingModelData);
(void)lock; // get rid of warning (void)lock; // get rid of warning
return SingletonHolder<MySmallObjAllocator, CreateStatic, return SingletonHolder<MySmallObjAllocator, CreateStatic,
@ -188,8 +166,7 @@ namespace Loki
static void operator delete(void* p, std::size_t size) static void operator delete(void* p, std::size_t size)
{ {
#if (MAX_SMALL_OBJECT_SIZE != 0) && (DEFAULT_CHUNK_SIZE != 0) #if (MAX_SMALL_OBJECT_SIZE != 0) && (DEFAULT_CHUNK_SIZE != 0)
typename MyThreadingModel::Lock lock( typename MyThreadingModel::Lock lock;
MySmallObjectStaticData::s_ThreadingModelData);
(void)lock; // get rid of warning (void)lock; // get rid of warning
SingletonHolder<MySmallObjAllocator, CreateStatic, SingletonHolder<MySmallObjAllocator, CreateStatic,

View file

@ -155,7 +155,9 @@ namespace Loki
// class template RefCountedMT // class template RefCountedMT
// Implementation of the OwnershipPolicy used by SmartPtr // Implementation of the OwnershipPolicy used by SmartPtr
// Implements external reference counting for multithreaded programs // Implements external reference counting for multithreaded programs
// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <template <class> class ThreadingModel> template <template <class> class ThreadingModel>
struct RefCountedMTAdj struct RefCountedMTAdj
{ {

View file

@ -54,9 +54,6 @@ namespace Loki
static IntType AtomicDecrement(volatile IntType& lval) static IntType AtomicDecrement(volatile IntType& lval)
{ return --lval; } { return --lval; }
static IntType AtomicDivide(volatile IntType& lval)
{ return lval /= val; }
static void AtomicAssign(volatile IntType & lval, IntType val) static void AtomicAssign(volatile IntType & lval, IntType val)
{ lval = val; } { lval = val; }
@ -98,13 +95,13 @@ namespace Loki
Lock(const Lock&); Lock(const Lock&);
Lock& operator=(const Lock&); Lock& operator=(const Lock&);
Lock(); // buggy design
public: public:
explicit Lock(ObjectLevelLockable& host) : host_(host) explicit Lock(ObjectLevelLockable& host) : host_(host)
{ {
::EnterCriticalSection(&host_.mtx_); ::EnterCriticalSection(&host_.mtx_);
} }
~Lock() ~Lock()
{ {
::LeaveCriticalSection(&host_.mtx_); ::LeaveCriticalSection(&host_.mtx_);

View file

@ -73,18 +73,18 @@ namespace Loki
typedef typename In<flag>::Result Result; typedef typename In<flag>::Result Result;
}; };
/*
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template SameType // class template IsSameType
// Return true iff two given types are the same // Return true iff two given types are the same
// Invocation: SameType<T, U>::value // Invocation: IsSameType<T, U>::value
// where: // where:
// T and U are types // T and U are types
// Result evaluates to true iff U == T (types equal) // Result evaluates to true iff U == T (types equal)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename T, typename U> template <typename T, typename U>
struct SameType struct IsSameType
{ {
private: private:
template<typename> template<typename>
@ -98,7 +98,6 @@ namespace Loki
public: public:
enum { value = In<U>::value }; enum { value = In<U>::value };
}; };
//*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
@ -113,10 +112,10 @@ namespace Loki
struct IsVoid struct IsVoid
{ {
enum { result = enum { result =
SameType<T, void>::value || IsSameType<T, void>::value ||
SameType<T, const void>::value || IsSameType<T, const void>::value ||
SameType<T, volatile void>::value || IsSameType<T, volatile void>::value ||
SameType<T, const volatile void>::value IsSameType<T, const volatile void>::value
}; };
}; };
} }
@ -172,7 +171,7 @@ namespace Loki
{ {
enum { exists = (is_convertible<T,U>::exists) }; enum { exists = (is_convertible<T,U>::exists) };
enum { exists2Way = (exists && is_convertible<U, T>::exists) }; enum { exists2Way = (exists && is_convertible<U, T>::exists) };
enum { sameType = (SameType<T, U>::value) }; enum { sameType = (IsSameType<T, U>::value) };
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -238,7 +237,7 @@ struct SuperSubclassStrict
// Change log: // Change log:
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
// May 10, 2002: ported by Rani Sharoni to VC7 (RTM - 9466) // May 10, 2002: ported by Rani Sharoni to VC7 (RTM - 9466)
// October 10, 2002: Commented SameType template (not a Loki-template - yet). MKH // October 10, 2002: Commented IsSameType template (not a Loki-template - yet). MKH
// October 12, 2002: Added SuperSubclass and SuperSubclassStrict templates. // October 12, 2002: Added SuperSubclass and SuperSubclassStrict templates.
// The corresponding macros are deprecated. T.S. // The corresponding macros are deprecated. T.S.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -226,10 +226,10 @@ namespace Loki
enum { enum {
isVoid = isVoid =
SameType<T, void>::value || IsSameType<T, void>::value ||
SameType<T, const void>::value || IsSameType<T, const void>::value ||
SameType<T, volatile void>::value || IsSameType<T, volatile void>::value ||
SameType<T, const volatile void>::value IsSameType<T, const volatile void>::value
}; };
enum { isStdUnsignedInt = enum { isStdUnsignedInt =

View file

@ -766,7 +766,7 @@ typedef char _type_##_is_not_a_Typelist[true]
public: public:
typedef typename Select typedef typename Select
< <
SameType<Head, T>::value, IsSameType<Head, T>::value,
TailResult, TailResult,
Typelist<Head, TailResult> Typelist<Head, TailResult>
> >
@ -885,7 +885,7 @@ typedef char _type_##_is_not_a_Typelist[true]
public: public:
typedef typename Select typedef typename Select
< <
SameType<Head, T>::value, IsSameType<Head, T>::value,
Typelist<U, TailResult>, Typelist<U, TailResult>,
Typelist<Head, TailResult> Typelist<Head, TailResult>
> >

View file

@ -14,6 +14,8 @@
# include "Reference/MultiMethods.h" # include "Reference/MultiMethods.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/MultiMethods.h" # include "Borland/MultiMethods.h"
# elif (_MSC_VER >= 1301)
# include "Reference/MultiMethods.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/MultiMethods.h" # include "MSVC/1300/MultiMethods.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/NullType.h" # include "Reference/NullType.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/NullType.h" # include "Borland/NullType.h"
# elif (_MSC_VER >= 1301)
# include "Reference/NullType.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/NullType.h" # include "MSVC/1300/NullType.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -16,7 +16,7 @@
#ifndef FACTORY_INC_ #ifndef FACTORY_INC_
#define FACTORY_INC_ #define FACTORY_INC_
#include "TypeInfo.h" #include "LokiTypeInfo.h"
#include "AssocVector.h" #include "AssocVector.h"
#include <exception> #include <exception>

View file

@ -24,6 +24,12 @@
namespace Loki namespace Loki
{ {
#if defined(_MSC_VER) && _MSC_VER >= 1300
#pragma warning( push )
// 'class1' : base-class 'class2' is already a base-class of 'class3'
#pragma warning( disable : 4584 )
#endif // _MSC_VER
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template GenScatterHierarchy // class template GenScatterHierarchy
// Generates a scattered hierarchy starting from a typelist and a template // Generates a scattered hierarchy starting from a typelist and a template
@ -244,6 +250,9 @@ namespace Loki
{ {
}; };
#if defined(_MSC_VER) && _MSC_VER >= 1300
#pragma warning( pop )
#endif
} // namespace Loki } // namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

108
Reference/LokiTypeInfo.h Normal file
View file

@ -0,0 +1,108 @@
////////////////////////////////////////////////////////////////////////////////
// The Loki Library
// Copyright (c) 2001 by Andrei Alexandrescu
// This code accompanies the book:
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
// Permission to use, copy, modify, distribute and sell this software for any
// purpose is hereby granted without fee, provided that the above copyright
// notice appear in all copies and that both that copyright notice and this
// permission notice appear in supporting documentation.
// The author or Addison-Wesley Longman make no representations about the
// suitability of this software for any purpose. It is provided "as is"
// without express or implied warranty.
////////////////////////////////////////////////////////////////////////////////
// Last update: June 20, 2001
#ifndef LOKITYPEINFO_INC_
#define LOKITYPEINFO_INC_
#include <typeinfo>
#include <cassert>
#include "Typelist.h"
namespace Loki
{
////////////////////////////////////////////////////////////////////////////////
// class TypeInfo
// Purpose: offer a first-class, comparable wrapper over std::type_info
////////////////////////////////////////////////////////////////////////////////
class TypeInfo
{
public:
// Constructors
TypeInfo(); // needed for containers
TypeInfo(const std::type_info&); // non-explicit
// Access for the wrapped std::type_info
const std::type_info& Get() const;
// Compatibility functions
bool before(const TypeInfo& rhs) const;
const char* name() const;
private:
const std::type_info* pInfo_;
};
// Implementation
inline TypeInfo::TypeInfo()
{
class Nil {};
pInfo_ = &typeid(Nil);
assert(pInfo_);
}
inline TypeInfo::TypeInfo(const std::type_info& ti)
: pInfo_(&ti)
{ assert(pInfo_); }
inline bool TypeInfo::before(const TypeInfo& rhs) const
{
assert(pInfo_);
// type_info::before return type is int in some VC libraries
return pInfo_->before(*rhs.pInfo_) != 0;
}
inline const std::type_info& TypeInfo::Get() const
{
assert(pInfo_);
return *pInfo_;
}
inline const char* TypeInfo::name() const
{
assert(pInfo_);
return pInfo_->name();
}
// Comparison operators
inline bool operator==(const TypeInfo& lhs, const TypeInfo& rhs)
// type_info::operator== return type is int in some VC libraries
{ return (lhs.Get() == rhs.Get()) != 0; }
inline bool operator<(const TypeInfo& lhs, const TypeInfo& rhs)
{ return lhs.before(rhs); }
inline bool operator!=(const TypeInfo& lhs, const TypeInfo& rhs)
{ return !(lhs == rhs); }
inline bool operator>(const TypeInfo& lhs, const TypeInfo& rhs)
{ return rhs < lhs; }
inline bool operator<=(const TypeInfo& lhs, const TypeInfo& rhs)
{ return !(lhs > rhs); }
inline bool operator>=(const TypeInfo& lhs, const TypeInfo& rhs)
{ return !(lhs < rhs); }
}
////////////////////////////////////////////////////////////////////////////////
// Change log:
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
////////////////////////////////////////////////////////////////////////////////
#endif // LOKITYPEINFO_INC_

View file

@ -17,7 +17,7 @@
#define MULTIMETHODS_INC_ #define MULTIMETHODS_INC_
#include "Typelist.h" #include "Typelist.h"
#include "TypeInfo.h" #include "LokiTypeInfo.h"
#include "Functor.h" #include "Functor.h"
#include "AssocVector.h" #include "AssocVector.h"
@ -77,13 +77,10 @@ namespace Loki
Executor exec, NullType) Executor exec, NullType)
{ return exec.OnError(lhs, rhs); } { return exec.OnError(lhs, rhs); }
template <class TList, class SomeLhs> template <class Head, class Tail, class SomeLhs>
static ResultType DispatchRhs(SomeLhs& lhs, BaseRhs& rhs, static ResultType DispatchRhs(SomeLhs& lhs, BaseRhs& rhs,
Executor exec, TList) Executor exec, Typelist<Head, Tail>)
{ {
typedef typename TList::Head Head;
typedef typename TList::Tail Tail;
if (Head* p2 = dynamic_cast<Head*>(&rhs)) if (Head* p2 = dynamic_cast<Head*>(&rhs))
{ {
Int2Type<(symmetric && Int2Type<(symmetric &&
@ -102,13 +99,10 @@ namespace Loki
Executor exec, NullType) Executor exec, NullType)
{ return exec.OnError(lhs, rhs); } { return exec.OnError(lhs, rhs); }
template <class TList> template <class Head, class Tail>
static ResultType DispatchLhs(BaseLhs& lhs, BaseRhs& rhs, static ResultType DispatchLhs(BaseLhs& lhs, BaseRhs& rhs,
Executor exec, TList) Executor exec, Typelist<Head, Tail>)
{ {
typedef typename TList::Head Head;
typedef typename TList::Tail Tail;
if (Head* p1 = dynamic_cast<Head*>(&lhs)) if (Head* p1 = dynamic_cast<Head*>(&lhs))
{ {
return DispatchRhs(*p1, rhs, exec, TypesRhs()); return DispatchRhs(*p1, rhs, exec, TypesRhs());
@ -286,7 +280,7 @@ namespace Loki
template <class SomeLhs, class SomeRhs, template <class SomeLhs, class SomeRhs,
ResultType (*callback)(SomeLhs&, SomeRhs&), ResultType (*callback)(SomeLhs&, SomeRhs&),
bool symmetric> bool symmetric>
void Add() void Add(bool = true) // [gcc] dummy bool
{ {
typedef Private::FnDispatcherHelper< typedef Private::FnDispatcherHelper<
BaseLhs, BaseRhs, BaseLhs, BaseRhs,

View file

@ -178,6 +178,11 @@ namespace Loki
template <class T> struct CreateStatic template <class T> struct CreateStatic
{ {
#if defined(_MSC_VER) && _MSC_VER >= 1300
#pragma warning( push )
// alignment of a member was sensitive to packing
#pragma warning( disable : 4121 )
#endif // _MSC_VER
union MaxAlign union MaxAlign
{ {
char t_[sizeof(T)]; char t_[sizeof(T)];
@ -191,6 +196,9 @@ namespace Loki
int Test::* pMember_; int Test::* pMember_;
int (Test::*pMemberFn_)(int); int (Test::*pMemberFn_)(int);
}; };
#if defined(_MSC_VER) && _MSC_VER >= 1300
#pragma warning( pop )
#endif // _MSC_VER
static T* Create() static T* Create()
{ {

View file

@ -18,6 +18,7 @@
#include "SmallObj.h" #include "SmallObj.h"
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <functional>
using namespace Loki; using namespace Loki;
@ -365,6 +366,20 @@ SmallObjAllocator::SmallObjAllocator(
{ {
} }
namespace { // anoymous
// See LWG DR #270
struct CompareFixedAllocatorSize
: std::binary_function<const FixedAllocator &, std::size_t, bool>
{
bool operator()(const FixedAllocator &x, std::size_t numBytes) const
{
return x.BlockSize() < numBytes;
}
};
} // anoymous namespace
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// SmallObjAllocator::Allocate // SmallObjAllocator::Allocate
// Allocates 'numBytes' memory // Allocates 'numBytes' memory
@ -379,7 +394,8 @@ void* SmallObjAllocator::Allocate(std::size_t numBytes)
{ {
return pLastAlloc_->Allocate(); return pLastAlloc_->Allocate();
} }
Pool::iterator i = std::lower_bound(pool_.begin(), pool_.end(), numBytes); Pool::iterator i = std::lower_bound(pool_.begin(), pool_.end(), numBytes,
CompareFixedAllocatorSize());
if (i == pool_.end() || i->BlockSize() != numBytes) if (i == pool_.end() || i->BlockSize() != numBytes)
{ {
i = pool_.insert(i, FixedAllocator(numBytes)); i = pool_.insert(i, FixedAllocator(numBytes));
@ -404,7 +420,8 @@ void SmallObjAllocator::Deallocate(void* p, std::size_t numBytes)
pLastDealloc_->Deallocate(p); pLastDealloc_->Deallocate(p);
return; return;
} }
Pool::iterator i = std::lower_bound(pool_.begin(), pool_.end(), numBytes); Pool::iterator i = std::lower_bound(pool_.begin(), pool_.end(), numBytes,
CompareFixedAllocatorSize());
assert(i != pool_.end()); assert(i != pool_.end());
assert(i->BlockSize() == numBytes); assert(i->BlockSize() == numBytes);
pLastDealloc_ = &*i; pLastDealloc_ = &*i;

View file

@ -86,9 +86,6 @@ namespace Loki
// Returns the block size with which the FixedAllocator was initialized // Returns the block size with which the FixedAllocator was initialized
std::size_t BlockSize() const std::size_t BlockSize() const
{ return blockSize_; } { return blockSize_; }
// Comparison operator for sorting
bool operator<(std::size_t rhs) const
{ return BlockSize() < rhs; }
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -152,56 +152,66 @@ namespace Loki
// class template RefCountedMT // class template RefCountedMT
// Implementation of the OwnershipPolicy used by SmartPtr // Implementation of the OwnershipPolicy used by SmartPtr
// Implements external reference counting for multithreaded programs // Implements external reference counting for multithreaded programs
// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class P,
template <class> class ThreadingModel>
class RefCountedMT : public ThreadingModel< RefCountedMT<P, ThreadingModel> >
{
public:
RefCountedMT()
{
pCount_ = static_cast<unsigned int*>(
SmallObject<ThreadingModel>::operator new(
sizeof(unsigned int)));
assert(pCount_);
*pCount_ = 1;
}
RefCountedMT(const RefCountedMT& rhs)
: pCount_(rhs.pCount_)
{}
// MWCW lacks template friends, hence the following kludge
template <typename P1>
RefCountedMT(const RefCountedMT<P1, ThreadingModel>& rhs)
: pCount_(reinterpret_cast<const RefCounted<P>&>(rhs).pCount_)
{}
P Clone(const P& val)
{
ThreadingModel<RefCountedMT>::AtomicIncrement(*pCount_);
return val;
}
bool Release(const P&)
{
if (!ThreadingModel<RefCountedMT>::AtomicDecrement(*pCount_))
{
SmallObject<ThreadingModel>::operator delete(pCount_,
sizeof(unsigned int));
return true;
}
return false;
}
void Swap(RefCountedMT& rhs)
{ std::swap(pCount_, rhs.pCount_); }
enum { destructiveCopy = false }; template <template <class> class ThreadingModel>
struct RefCountedMTAdj
{
template <class P>
class RefCountedMT : public ThreadingModel< RefCountedMT<P> >
{
typedef ThreadingModel< RefCountedMT<P> > base_type;
typedef typename base_type::IntType CountType;
typedef volatile CountType *CountPtrType;
private: public:
// Data RefCountedMT()
volatile unsigned int* pCount_; {
pCount_ = static_cast<CountPtrType>(
SmallObject<ThreadingModel>::operator new(
sizeof(*pCount_)));
assert(pCount_);
*pCount_ = 1;
}
RefCountedMT(const RefCountedMT& rhs)
: pCount_(rhs.pCount_)
{}
//MWCW lacks template friends, hence the following kludge
template <typename P1>
RefCountedMT(const RefCountedMT<P1>& rhs)
: pCount_(reinterpret_cast<const RefCountedMT<P>&>(rhs).pCount_)
{}
P Clone(const P& val)
{
ThreadingModel<RefCountedMT>::AtomicIncrement(*pCount_);
return val;
}
bool Release(const P&)
{
if (!ThreadingModel<RefCountedMT>::AtomicDecrement(*pCount_))
{
SmallObject<ThreadingModel>::operator delete(
const_cast<CountType *>(pCount_),
sizeof(*pCount_));
return true;
}
return false;
}
void Swap(RefCountedMT& rhs)
{ std::swap(pCount_, rhs.pCount_); }
enum { destructiveCopy = false };
private:
// Data
CountPtrType pCount_;
};
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -514,7 +524,7 @@ namespace Loki
{} {}
static void OnDereference(P val) static void OnDereference(P val)
{ assert(val); } { assert(val); (void)val; }
static void Swap(AssertCheck&) static void Swap(AssertCheck&)
{} {}
@ -691,6 +701,7 @@ namespace Loki
// gcc doesn't like this: // gcc doesn't like this:
// operator const T&() const { return value_; } // operator const T&() const { return value_; }
private: private:
ByRef& operator=(const ByRef &);
T& value_; T& value_;
}; };
@ -709,6 +720,33 @@ namespace Loki
> >
class SmartPtr; class SmartPtr;
////////////////////////////////////////////////////////////////////////////////
// class template SmartPtrDef (definition)
// this class added to unify the usage of SmartPtr
// instead of writing SmartPtr<T,OP,CP,KP,SP> write SmartPtrDef<T,OP,CP,KP,SP>::type
////////////////////////////////////////////////////////////////////////////////
template
<
typename T,
template <class> class OwnershipPolicy = RefCounted,
class ConversionPolicy = DisallowConversion,
template <class> class CheckingPolicy = AssertCheck,
template <class> class StoragePolicy = DefaultSPStorage
>
struct SmartPtrDef
{
typedef SmartPtr
<
T,
OwnershipPolicy,
ConversionPolicy,
CheckingPolicy,
StoragePolicy
>
type;
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template SmartPtr (definition) // class template SmartPtr (definition)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -30,7 +30,7 @@ namespace Loki
struct Lock struct Lock
{ {
Lock() {} Lock() {}
Lock(const Host&) {} explicit Lock(const SingleThreaded&) {}
}; };
typedef Host VolatileType; typedef Host VolatileType;
@ -96,10 +96,12 @@ namespace Loki
Lock(const Lock&); Lock(const Lock&);
Lock& operator=(const Lock&); Lock& operator=(const Lock&);
public: public:
Lock(Host& host) : host_(host)
explicit Lock(ObjectLevelLockable& host) : host_(host)
{ {
::EnterCriticalSection(&host_.mtx_); ::EnterCriticalSection(&host_.mtx_);
} }
~Lock() ~Lock()
{ {
::LeaveCriticalSection(&host_.mtx_); ::LeaveCriticalSection(&host_.mtx_);
@ -126,12 +128,10 @@ namespace Loki
template <class Host> template <class Host>
class ClassLevelLockable class ClassLevelLockable
{ {
static CRITICAL_SECTION mtx_;
struct Initializer;
friend struct Initializer;
struct Initializer struct Initializer
{ {
CRITICAL_SECTION mtx_;
Initializer() Initializer()
{ {
::InitializeCriticalSection(&mtx_); ::InitializeCriticalSection(&mtx_);
@ -155,15 +155,15 @@ namespace Loki
public: public:
Lock() Lock()
{ {
::EnterCriticalSection(&mtx_); ::EnterCriticalSection(&initializer_.mtx_);
} }
Lock(Host&) explicit Lock(ClassLevelLockable&)
{ {
::EnterCriticalSection(&mtx_); ::EnterCriticalSection(&initializer_.mtx_);
} }
~Lock() ~Lock()
{ {
::LeaveCriticalSection(&mtx_); ::LeaveCriticalSection(&initializer_.mtx_);
} }
}; };
@ -184,9 +184,6 @@ namespace Loki
{ InterlockedExchange(&lval, val); } { InterlockedExchange(&lval, val); }
}; };
template <class Host>
CRITICAL_SECTION ClassLevelLockable<Host>::mtx_;
template <class Host> template <class Host>
typename ClassLevelLockable<Host>::Initializer typename ClassLevelLockable<Host>::Initializer
ClassLevelLockable<Host>::initializer_; ClassLevelLockable<Host>::initializer_;
@ -197,8 +194,6 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Change log: // Change log:
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
// January 10, 2002: Fixed bug in AtomicDivide - credit due to Jordi Guerrero
// August 14, 2002: Changed some AtomicDivide's to AtomicDecrement's MKH
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif #endif

View file

@ -67,6 +67,27 @@ namespace Loki
typedef U Result; typedef U Result;
}; };
////////////////////////////////////////////////////////////////////////////////
// class template IsSameType
// Return true iff two given types are the same
// Invocation: SameType<T, U>::value
// where:
// T and U are types
// Result evaluates to true iff U == T (types equal)
////////////////////////////////////////////////////////////////////////////////
template <typename T, typename U>
struct IsSameType
{
enum { value = false };
};
template <typename T>
struct IsSameType<T,T>
{
enum { value = true };
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -128,11 +149,11 @@ namespace Loki
template <class T> template <class T>
struct Conversion<T, void> struct Conversion<T, void>
{ {
enum { exists = 1, exists2Way = 0, sameType = 0 }; enum { exists = 0, exists2Way = 0, sameType = 0 };
}; };
template <> template <>
class Conversion<void, void> struct Conversion<void, void>
{ {
public: public:
enum { exists = 1, exists2Way = 1, sameType = 1 }; enum { exists = 1, exists2Way = 1, sameType = 1 };

View file

@ -407,15 +407,8 @@ namespace Loki
}; };
template<> template<>
struct MakeTypelist struct MakeTypelist<>
< {
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType
>{
typedef NullType Result; typedef NullType Result;
}; };

View file

@ -143,7 +143,7 @@ struct DefaultCatchAll
static ReturnType AcceptImpl(T& visited, BaseVisitor& guest) static ReturnType AcceptImpl(T& visited, BaseVisitor& guest)
{ {
// Apply the Acyclic Visitor // Apply the Acyclic Visitor
if (Visitor<T>* p = dynamic_cast<Visitor<T>*>(&guest)) if (Visitor<T,R>* p = dynamic_cast<Visitor<T,R>*>(&guest))
{ {
return p->Visit(visited); return p->Visit(visited);
} }

View file

@ -14,6 +14,8 @@
# include "Reference/Singleton.h" # include "Reference/Singleton.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Singleton.h" # include "Borland/Singleton.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Singleton.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Singleton.h" # include "MSVC/1300/Singleton.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/SmallObj.h" # include "Reference/SmallObj.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/SmallObj.h" # include "Borland/SmallObj.h"
# elif (_MSC_VER >= 1301)
# include "Reference/SmallObj.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/SmallObj.h" # include "MSVC/1300/SmallObj.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/SmartPtr.h" # include "Reference/SmartPtr.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/SmartPtr.h" # include "Borland/SmartPtr.h"
# elif (_MSC_VER >= 1301)
# include "Reference/SmartPtr.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/SmartPtr.h" # include "MSVC/1300/SmartPtr.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/Threads.h" # include "Reference/Threads.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Threads.h" # include "Borland/Threads.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Threads.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Threads.h" # include "MSVC/1300/Threads.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/Tuple.h" # include "Reference/Tuple.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Tuple.h" # include "Borland/Tuple.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Tuple.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Tuple.h" # include "MSVC/1300/Tuple.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/TypeManip.h" # include "Reference/TypeManip.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/TypeManip.h" # include "Borland/TypeManip.h"
# elif (_MSC_VER >= 1301)
# include "Reference/TypeManip.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/TypeManip.h" # include "MSVC/1300/TypeManip.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/TypeTraits.h" # include "Reference/TypeTraits.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/TypeTraits.h" # include "Borland/TypeTraits.h"
# elif (_MSC_VER >= 1301)
# include "Reference/TypeTraits.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/TypeTraits.h" # include "MSVC/1300/TypeTraits.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/Typelist.h" # include "Reference/Typelist.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Typelist.h" # include "Borland/Typelist.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Typelist.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Typelist.h" # include "MSVC/1300/Typelist.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/Visitor.h" # include "Reference/Visitor.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/Visitor.h" # include "Borland/Visitor.h"
# elif (_MSC_VER >= 1301)
# include "Reference/Visitor.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/Visitor.h" # include "MSVC/1300/Visitor.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -14,6 +14,8 @@
# include "Reference/static_check.h" # include "Reference/static_check.h"
# elif (__BORLANDC__ >= 0x560) # elif (__BORLANDC__ >= 0x560)
# include "Borland/static_check.h" # include "Borland/static_check.h"
# elif (_MSC_VER >= 1301)
# include "Reference/static_check.h"
# elif (_MSC_VER >= 1300) # elif (_MSC_VER >= 1300)
# include "MSVC/1300/static_check.h" # include "MSVC/1300/static_check.h"
# elif (_MSC_VER >= 1200) # elif (_MSC_VER >= 1200)

View file

@ -13,7 +13,7 @@ SmartPtr.h
static_check.h static_check.h
Threads.h Threads.h
Tuple.h Tuple.h
TypeInfo.h LokiTypeInfo.h
Typelist.h Typelist.h
TypeManip.h TypeManip.h
TypeTraits.h TypeTraits.h

View file

@ -7,6 +7,9 @@ Reference
(__BORLANDC__ >= 0x560) (__BORLANDC__ >= 0x560)
Borland Borland
(_MSC_VER >= 1301)
Reference
(_MSC_VER >= 1300) (_MSC_VER >= 1300)
MSVC/1300 MSVC/1300

View file

@ -97,7 +97,7 @@ public:
virtual void execute(TestResult &) =0; virtual void execute(TestResult &) =0;
protected: protected:
~Test() {} virtual ~Test() {}
void printName(const TestResult &result) const void printName(const TestResult &result) const
{ {