no message
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@67 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
34baf93ed8
commit
44d1bc8ebf
21 changed files with 336 additions and 97 deletions
|
@ -1,13 +1,19 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Data Generator by Shannon Barber
|
||||
// Data Generator by Mr. Shannon Barber
|
||||
// This code DOES NOT accompany the book:
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
|
||||
//
|
||||
// Code covered by the MIT License
|
||||
//
|
||||
// The author makes no representations about the suitability of this software
|
||||
// for any purpose. It is provided "as is" without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Last update: Oct 10, 2002
|
||||
|
||||
#pragma once
|
||||
#include "TypeList.h"
|
||||
|
||||
//MSVC7 version
|
||||
|
@ -95,7 +101,12 @@ namespace Loki
|
|||
void operator()(II ii)
|
||||
{
|
||||
genfunc_t gen;
|
||||
//warning C4267: 'argument' : conversion from 'size_t' to 'const std::_Vbase', possible loss of data
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4267)
|
||||
//TODOSGB
|
||||
*ii = gen();
|
||||
#pragma warning(pop)
|
||||
++ii;
|
||||
}
|
||||
template<class II, class P1>
|
||||
|
@ -201,7 +212,7 @@ namespace Loki
|
|||
//UnitFunc is really a template-template parameter, but MSVC7
|
||||
// chokes on the correct defintion. Oddly enough, it works correctly
|
||||
// with the 'undecorated' template parameter declaraion!
|
||||
//template <typename> class UnitFunc
|
||||
//template <class> class UnitFunc
|
||||
template<typename Types, class UnitFunc, typename II>
|
||||
void iterate_types(II ii)
|
||||
{
|
||||
|
@ -215,5 +226,6 @@ namespace Loki
|
|||
// Change log:
|
||||
// Aug 17, 2002: Ported to MSVC7 by Rani Sharoni
|
||||
// Aug 18, 2002: Removed ctor(II), replaced with operator(II) Shannon Barber
|
||||
// Oct 10, 2002: Changed II (insertion iterator) from pass-by-reference to pass-by-value
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Last update: May 19, 2002
|
||||
// Last update: Oct 10, 2002
|
||||
|
||||
#ifndef FUNCTOR_INC_
|
||||
#define FUNCTOR_INC_
|
||||
|
@ -61,7 +61,10 @@ namespace Loki
|
|||
{
|
||||
if (!pObj) return 0;
|
||||
U* pClone = static_cast<U*>(pObj->DoClone());
|
||||
assert(typeid(*pClone) == typeid(*pObj));
|
||||
//MSVC7: warning C4541: 'typeid' used on polymorphic type 'Loki::FunctorImpl<R,TList,ThreadingModel>' with /GR-; unpredictable behavior may result
|
||||
//I rather RTTI wasn't a requirement
|
||||
//TODOSGB find another way
|
||||
//assert(typeid(*pClone) == typeid(*pObj));
|
||||
return pClone;
|
||||
}
|
||||
};
|
||||
|
@ -1342,6 +1345,7 @@ namespace Loki
|
|||
// Change log:
|
||||
// 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)
|
||||
// Oct 10, 2002: removed rtti/polymorphic use of typeid
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // FUNCTOR_INC_
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Loki
|
|||
typedef typename In<flag>::Result Result;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template SameType
|
||||
// Return true iff two given types are the same
|
||||
|
@ -98,6 +98,7 @@ namespace Loki
|
|||
public:
|
||||
enum { value = In<U>::value };
|
||||
};
|
||||
//*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
|
||||
|
@ -183,6 +184,38 @@ namespace Loki
|
|||
// Caveat: might not work if T and U are in a private inheritance hierarchy.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template SuperSubclass
|
||||
// Invocation: SuperSubclass<B, D>::value where B and D are types.
|
||||
// Returns true if B is a public base of D, or if B and D are aliases of the
|
||||
// same type.
|
||||
//
|
||||
// Caveat: might not work if T and U are in a private inheritance hierarchy.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T, class U>
|
||||
struct SuperSubclass
|
||||
{
|
||||
enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists &&
|
||||
!::Loki::Conversion<const volatile T*, const volatile void*>::sameType) };
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template SuperSubclassStrict
|
||||
// Invocation: SuperSubclassStrict<B, D>::value where B and D are types.
|
||||
// Returns true if B is a public base of D.
|
||||
//
|
||||
// Caveat: might not work if T and U are in a private inheritance hierarchy.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class T,class U>
|
||||
struct SuperSubclassStrict
|
||||
{
|
||||
enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists &&
|
||||
!::Loki::Conversion<const volatile T*, const volatile void*>::sameType &&
|
||||
!::Loki::Conversion<const volatile T*, const volatile U*>::sameType) };
|
||||
};
|
||||
|
||||
#define SUPERSUBCLASS(T, U) \
|
||||
(::Loki::Conversion<const volatile U*, const volatile T*>::exists && \
|
||||
!::Loki::Conversion<const volatile T*, const volatile void*>::sameType)
|
||||
|
@ -205,6 +238,7 @@ namespace Loki
|
|||
// Change log:
|
||||
// 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)
|
||||
// Oct 10, 2002: Commented SameType template (not a loki-template - yet)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // TYPEMANIP_INC_
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
// Last update: May 19, 2002
|
||||
|
||||
//TODOSGB None of the parameter types are defined inside of TypeTraits, e.g. PointeeType, ReferredType, etc...
|
||||
|
||||
#ifndef TYPETRAITS_INC_
|
||||
#define TYPETRAITS_INC_
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue