Added protected destructors to private implementation classes
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@117 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
1d7f58a574
commit
ee3342ed54
4 changed files with 88 additions and 57 deletions
|
@ -82,6 +82,8 @@ namespace Private
|
|||
head.operator()(ii);
|
||||
tail.operator()(ii);
|
||||
}
|
||||
protected:
|
||||
~In() {}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -100,6 +102,8 @@ namespace Private
|
|||
*ii = genfunc();
|
||||
++ii; //Is this even needed?
|
||||
}
|
||||
protected:
|
||||
~In() {}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -113,6 +117,8 @@ namespace Private
|
|||
template<class II>
|
||||
void operator()(II ii)
|
||||
{}
|
||||
protected:
|
||||
~In() {}
|
||||
};
|
||||
};
|
||||
} // end ns Private
|
||||
|
@ -140,4 +146,5 @@ namespace Private
|
|||
// 9/20/02 Named changed from GenData to IterateTypes
|
||||
// 10/8/02 insertion iterators are passed-by-value, not by-reference (oops)
|
||||
// 03/04/03 ported by Benjamin Kaufmann to MSVC 6.0
|
||||
// 03/06/03 added protected destructors to private implementation classes B.K.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -743,7 +743,8 @@ namespace Private
|
|||
return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
|
||||
p14, p15);
|
||||
}
|
||||
|
||||
protected:
|
||||
~FunctorHandlerBase() {}
|
||||
private:
|
||||
Fun f_;
|
||||
};
|
||||
|
@ -844,7 +845,8 @@ namespace Private
|
|||
f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
|
||||
p14, p15);
|
||||
}
|
||||
|
||||
protected:
|
||||
~FunctorHandlerVoidBase() {}
|
||||
private:
|
||||
Fun f_;
|
||||
};
|
||||
|
@ -1007,7 +1009,9 @@ namespace Private
|
|||
p11, p12, p13, p14, p15);
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
~MemFunHandlerBase() {}
|
||||
private:
|
||||
PointerToObj pObj_;
|
||||
PointerToMemFn pMemFn_;
|
||||
};
|
||||
|
@ -1118,7 +1122,8 @@ namespace Private
|
|||
((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
|
||||
p11, p12, p13, p14, p15);
|
||||
}
|
||||
|
||||
protected:
|
||||
~MemFunHandlerVoidBase() {}
|
||||
private:
|
||||
PointerToObj pObj_;
|
||||
PointerToMemFn pMemFn_;
|
||||
|
@ -1306,6 +1311,7 @@ namespace Private
|
|||
}
|
||||
protected:
|
||||
std::auto_ptr<Impl> spImpl_;
|
||||
~FunctorBase() {}
|
||||
};
|
||||
|
||||
// implementation class for Functor with return type = void
|
||||
|
@ -1426,6 +1432,7 @@ namespace Private
|
|||
}
|
||||
protected:
|
||||
std::auto_ptr<Impl> spImpl_;
|
||||
~FunctorVoidBase() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1765,8 +1772,8 @@ namespace Private
|
|||
p14);
|
||||
}
|
||||
|
||||
// VC7 BUG
|
||||
virtual ~BinderFirstBase() {}
|
||||
protected:
|
||||
~BinderFirstBase() {}
|
||||
private:
|
||||
OriginalFunctor f_;
|
||||
BoundType b_;
|
||||
|
@ -1860,8 +1867,8 @@ namespace Private
|
|||
p14);
|
||||
}
|
||||
|
||||
// VC7 BUG
|
||||
virtual ~BinderFirstVoidBase() {}
|
||||
protected:
|
||||
~BinderFirstVoidBase() {}
|
||||
private:
|
||||
OriginalFunctor f_;
|
||||
BoundType b_;
|
||||
|
@ -1998,12 +2005,7 @@ namespace Private
|
|||
ChainerBase(const Fun1& fun1, const Fun2& fun2)
|
||||
: f1_(fun1), f2_(fun2) {}
|
||||
|
||||
//
|
||||
// VC7 don't see this implicit constructor
|
||||
//
|
||||
|
||||
virtual ~ChainerBase() {}
|
||||
|
||||
|
||||
// operator() implementations for up to 15 arguments
|
||||
|
||||
ResultType operator()()
|
||||
|
@ -2102,6 +2104,7 @@ namespace Private
|
|||
protected:
|
||||
Fun1 f1_;
|
||||
Fun2 f2_;
|
||||
~ChainerBase() {}
|
||||
|
||||
};
|
||||
|
||||
|
@ -2132,12 +2135,6 @@ namespace Private
|
|||
ChainerVoidBase(const Fun1& fun1, const Fun2& fun2)
|
||||
: f1_(fun1), f2_(fun2) {}
|
||||
|
||||
//
|
||||
// VC7 don't see this implicit constructor
|
||||
//
|
||||
|
||||
virtual ~ChainerVoidBase() {}
|
||||
|
||||
// operator() implementations for up to 15 arguments
|
||||
|
||||
ResultType operator()()
|
||||
|
@ -2236,7 +2233,7 @@ namespace Private
|
|||
protected:
|
||||
Fun1 f1_;
|
||||
Fun2 f2_;
|
||||
|
||||
~ChainerVoidBase() {}
|
||||
};
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2329,6 +2326,7 @@ namespace Private
|
|||
// Replaced the void return workaround.
|
||||
// B.K.
|
||||
// Feb 25, 2003: added conversion unspecified_bool_type. B.K.
|
||||
// Mar 06, 2003: added protected destructors to private implementation classes B.K.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // FUNCTOR_INC_
|
||||
#endif // #ifdef USE_FUNCTOR_OLD_VERSION
|
|
@ -137,6 +137,8 @@ namespace Private
|
|||
return DispatchLhs(lhs, rhs, exec, Tail());
|
||||
}
|
||||
|
||||
protected:
|
||||
~StaticDispatcherBase() {}
|
||||
public:
|
||||
static ResultType Go( BaseLhs& lhs, BaseRhs& rhs,
|
||||
Executor exec)
|
||||
|
@ -189,6 +191,8 @@ namespace Private
|
|||
DispatchLhs(lhs, rhs, exec, Tail());
|
||||
}
|
||||
|
||||
protected:
|
||||
~StaticDispatcherVoidBase() {}
|
||||
public:
|
||||
static ResultType Go( BaseLhs& lhs, BaseRhs& rhs,
|
||||
Executor exec)
|
||||
|
@ -209,8 +213,7 @@ namespace Private
|
|||
bool symmetric = true,
|
||||
class BaseRhs = BaseLhs,
|
||||
class TypesRhs = TypesLhs,
|
||||
typename ResultType = Loki::Select<
|
||||
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result
|
||||
typename ResultType = Loki::Private::VoidWrap::type
|
||||
>
|
||||
class StaticDispatcher : public ::Loki::Select
|
||||
<
|
||||
|
@ -255,6 +258,7 @@ namespace Private
|
|||
typedef CallbackType MappedType;
|
||||
typedef AssocVector<KeyType, MappedType> MapType;
|
||||
MapType callbackMap_;
|
||||
~BasicDispatcherCommonBase() {}
|
||||
public:
|
||||
template <class SomeLhs, class SomeRhs>
|
||||
void Add(CallbackType fun, ::Loki::Type2Type<SomeLhs>,
|
||||
|
@ -295,6 +299,8 @@ namespace Private
|
|||
typedef BasicDispatcherCommonBase<CallbackType> Base;
|
||||
|
||||
ResultType Go(BaseLhs& lhs, BaseRhs& rhs);
|
||||
protected:
|
||||
~BasicDispatcherBase() {}
|
||||
};
|
||||
template <class BaseLhs, class BaseRhs,
|
||||
typename ResultType, typename CallbackType>
|
||||
|
@ -320,6 +326,8 @@ namespace Private
|
|||
typedef BasicDispatcherCommonBase<CallbackType> Base;
|
||||
|
||||
ResultType Go(BaseLhs& lhs, BaseRhs& rhs);
|
||||
protected:
|
||||
~BasicDispatcherVoidBase() {}
|
||||
};
|
||||
template <class BaseLhs, class BaseRhs, typename CallbackType>
|
||||
typename BasicDispatcherVoidBase<BaseLhs,BaseRhs, CallbackType>::ResultType
|
||||
|
@ -346,8 +354,7 @@ namespace Private
|
|||
<
|
||||
class BaseLhs,
|
||||
class BaseRhs = BaseLhs,
|
||||
typename ResultType = Loki::Select<
|
||||
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result,
|
||||
typename ResultType = Loki::Private::VoidWrap::type,
|
||||
typename CallbackType = ResultType (*)(BaseLhs&, BaseRhs&)
|
||||
>
|
||||
class BasicDispatcher : public ::Loki::Select
|
||||
|
@ -440,6 +447,8 @@ namespace Private
|
|||
{
|
||||
return backEnd_.Go(lhs, rhs);
|
||||
}
|
||||
protected:
|
||||
~FnDispatcherBase() {}
|
||||
};
|
||||
|
||||
template <class BaseLhs, class BaseRhs, class DispatcherBackend>
|
||||
|
@ -453,6 +462,8 @@ namespace Private
|
|||
{
|
||||
backEnd_.Go(lhs, rhs);
|
||||
}
|
||||
protected:
|
||||
~FnDispatcherVoidBase() {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -470,6 +481,8 @@ namespace Private
|
|||
{
|
||||
Trampoline(lhs, rhs);
|
||||
}
|
||||
protected:
|
||||
~FnDispatcherHelperVoidBase() {}
|
||||
};
|
||||
|
||||
template<typename ResultType, class BaseLhs, class BaseRhs,
|
||||
|
@ -486,6 +499,8 @@ namespace Private
|
|||
{
|
||||
Trampoline(lhs, rhs);
|
||||
}
|
||||
protected:
|
||||
~FnDispatcherHelperBase() {}
|
||||
};
|
||||
|
||||
template
|
||||
|
@ -514,8 +529,7 @@ namespace Private
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class BaseLhs, class BaseRhs = BaseLhs,
|
||||
typename ResultType = Loki::Select<
|
||||
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result,
|
||||
typename ResultType = Loki::Private::VoidWrap::type,
|
||||
class CastingPolicy = DynamicCasterWrapper,
|
||||
class DispatcherBackend = BasicDispatcherWrapper>
|
||||
class FnDispatcher : public ::Loki::Select
|
||||
|
@ -657,6 +671,7 @@ namespace Private
|
|||
|
||||
ApplyInnerType4<DispatcherBackend,BaseLhs, BaseRhs, ResultType,
|
||||
FunctorType>::type backEnd_;
|
||||
~FunctorDispatcherCommonBase() {}
|
||||
};
|
||||
|
||||
template <typename ResultType, class BaseLhs, class BaseRhs,
|
||||
|
@ -674,6 +689,8 @@ namespace Private
|
|||
{
|
||||
return Base::backEnd_.Go(lhs, rhs);
|
||||
}
|
||||
protected:
|
||||
~FunctorDispatcherBase() {}
|
||||
};
|
||||
|
||||
template <class BaseLhs, class BaseRhs, class DispatcherBackend>
|
||||
|
@ -691,7 +708,8 @@ namespace Private
|
|||
{
|
||||
Base::backEnd_.Go(lhs, rhs);
|
||||
}
|
||||
|
||||
protected:
|
||||
~FunctorDispatcherVoidBase() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -702,8 +720,7 @@ namespace Private
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class BaseLhs, class BaseRhs = BaseLhs,
|
||||
typename ResultType = Loki::Select<
|
||||
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result,
|
||||
typename ResultType = Loki::Private::VoidWrap::type,
|
||||
class CastingPolicy = DynamicCasterWrapper,
|
||||
class DispatcherBackend = BasicDispatcherWrapper>
|
||||
class FunctorDispatcher : public ::Loki::Select
|
||||
|
@ -784,7 +801,8 @@ namespace Private
|
|||
// Oct 28, 2002: ported by Benjamin Kaufmann to MSVC 6
|
||||
// Feb 19, 2003: replaced pointer-Dummies with Type2Type-Parameters and added
|
||||
// support for return type void. B.K.
|
||||
// Mar 06, 2003: Changed default values for return types to void B.K.
|
||||
// Mar 06, 2003: Changed default values for return types to void.
|
||||
// Added protected destructors to private implementation classes B.K.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
|
|
@ -260,6 +260,8 @@ namespace Private
|
|||
ASSERT_TYPELIST(TList);
|
||||
virtual R Visit(typename TList::Head&)
|
||||
{ return R(); }
|
||||
protected:
|
||||
~BaseVisitorImplBase() {}
|
||||
};
|
||||
|
||||
template <class TList, class R>
|
||||
|
@ -270,6 +272,8 @@ namespace Private
|
|||
ASSERT_TYPELIST(TList);
|
||||
virtual R Visit(typename TList::Head&)
|
||||
{ }
|
||||
protected:
|
||||
~BaseVisitorImplVoidBase() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -292,10 +296,6 @@ namespace Private
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template DefaultCatchAll
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
namespace Private
|
||||
{
|
||||
|
||||
}
|
||||
template <typename R, typename Visited>
|
||||
struct DefaultCatchAll
|
||||
{
|
||||
|
@ -376,36 +376,39 @@ namespace Private
|
|||
class BaseVisitableBase
|
||||
{
|
||||
typedef R ReturnType;
|
||||
protected:
|
||||
template <class T>
|
||||
static ReturnType AcceptImpl(T& visited, BaseVisitor& guest)
|
||||
protected:
|
||||
template <class T>
|
||||
static ReturnType AcceptImpl(T& visited, BaseVisitor& guest)
|
||||
{
|
||||
typedef ApplyInnerType2<CatchAll, R, T>::type CatchA;
|
||||
// Apply the Acyclic Visitor
|
||||
if (Visitor<T, R>* p = dynamic_cast<Visitor<T, R>*>(&guest))
|
||||
{
|
||||
typedef ApplyInnerType2<CatchAll, R, T>::type CatchA;
|
||||
// Apply the Acyclic Visitor
|
||||
if (Visitor<T, R>* p = dynamic_cast<Visitor<T, R>*>(&guest))
|
||||
{
|
||||
return p->Visit(visited);
|
||||
}
|
||||
return CatchA::OnUnknownVisitor(visited, guest);
|
||||
return p->Visit(visited);
|
||||
}
|
||||
return CatchA::OnUnknownVisitor(visited, guest);
|
||||
}
|
||||
~BaseVisitableBase() {}
|
||||
|
||||
};
|
||||
template <class R, class CatchAll>
|
||||
class BaseVisitableVoidBase
|
||||
{
|
||||
typedef R ReturnType;
|
||||
protected:
|
||||
template <class T>
|
||||
static ReturnType AcceptImpl(T& visited, BaseVisitor& guest)
|
||||
protected:
|
||||
template <class T>
|
||||
static ReturnType AcceptImpl(T& visited, BaseVisitor& guest)
|
||||
{
|
||||
typedef ApplyInnerType2<CatchAll, R, T>::type CatchA;
|
||||
// Apply the Acyclic Visitor
|
||||
if (Visitor<T>* p = dynamic_cast<Visitor<T>*>(&guest))
|
||||
{
|
||||
typedef ApplyInnerType2<CatchAll, R, T>::type CatchA;
|
||||
// Apply the Acyclic Visitor
|
||||
if (Visitor<T>* p = dynamic_cast<Visitor<T>*>(&guest))
|
||||
{
|
||||
p->Visit(visited);
|
||||
return;
|
||||
}
|
||||
CatchA::OnUnknownVisitor(visited, guest);
|
||||
p->Visit(visited);
|
||||
return;
|
||||
}
|
||||
CatchA::OnUnknownVisitor(visited, guest);
|
||||
}
|
||||
~BaseVisitableVoidBase() {}
|
||||
};
|
||||
}
|
||||
template
|
||||
|
@ -456,6 +459,8 @@ namespace Private
|
|||
Visitor<Visited, ReturnType>& subObj = *this;
|
||||
return subObj.Visit(host);
|
||||
}
|
||||
protected:
|
||||
~CyclicVisitorBase() {}
|
||||
};
|
||||
template <class TList>
|
||||
class CyclicVisitorVoidBase : public Visitor<TList, void>
|
||||
|
@ -467,6 +472,8 @@ namespace Private
|
|||
Visitor<Visited, ReturnType>& subObj = *this;
|
||||
subObj.Visit(host);
|
||||
}
|
||||
protected:
|
||||
~CyclicVisitorVoidBase() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -505,7 +512,8 @@ namespace Private
|
|||
// Oct 27, 2002: ported by Benjamin Kaufmann to MSVC 6.0
|
||||
// Feb 23, 2003: Removed special visitor classes for return type void.
|
||||
// Added Loki:: qualification to Accept's Paramter (in the macro) B.K.
|
||||
// Mar 06, 2003: Changed default values for return types to void B.K.
|
||||
// Mar 06, 2003: Changed default values for return types to void.
|
||||
// Added protected destructors to private implementation classes B.K.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // VISITOR_INC_
|
||||
|
|
Loading…
Reference in a new issue