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:
humesikkins 2003-03-06 13:54:00 +00:00
parent 1d7f58a574
commit ee3342ed54
4 changed files with 88 additions and 57 deletions

View file

@ -82,6 +82,8 @@ namespace Private
head.operator()(ii); head.operator()(ii);
tail.operator()(ii); tail.operator()(ii);
} }
protected:
~In() {}
}; };
}; };
@ -100,6 +102,8 @@ namespace Private
*ii = genfunc(); *ii = genfunc();
++ii; //Is this even needed? ++ii; //Is this even needed?
} }
protected:
~In() {}
}; };
}; };
@ -113,6 +117,8 @@ namespace Private
template<class II> template<class II>
void operator()(II ii) void operator()(II ii)
{} {}
protected:
~In() {}
}; };
}; };
} // end ns Private } // end ns Private
@ -140,4 +146,5 @@ namespace Private
// 9/20/02 Named changed from GenData to IterateTypes // 9/20/02 Named changed from GenData to IterateTypes
// 10/8/02 insertion iterators are passed-by-value, not by-reference (oops) // 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/04/03 ported by Benjamin Kaufmann to MSVC 6.0
// 03/06/03 added protected destructors to private implementation classes B.K.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -743,7 +743,8 @@ namespace Private
return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
p14, p15); p14, p15);
} }
protected:
~FunctorHandlerBase() {}
private: private:
Fun f_; Fun f_;
}; };
@ -844,7 +845,8 @@ namespace Private
f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
p14, p15); p14, p15);
} }
protected:
~FunctorHandlerVoidBase() {}
private: private:
Fun f_; Fun f_;
}; };
@ -1007,6 +1009,8 @@ namespace Private
p11, p12, p13, p14, p15); p11, p12, p13, p14, p15);
} }
protected:
~MemFunHandlerBase() {}
private: private:
PointerToObj pObj_; PointerToObj pObj_;
PointerToMemFn pMemFn_; PointerToMemFn pMemFn_;
@ -1118,7 +1122,8 @@ namespace Private
((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
p11, p12, p13, p14, p15); p11, p12, p13, p14, p15);
} }
protected:
~MemFunHandlerVoidBase() {}
private: private:
PointerToObj pObj_; PointerToObj pObj_;
PointerToMemFn pMemFn_; PointerToMemFn pMemFn_;
@ -1306,6 +1311,7 @@ namespace Private
} }
protected: protected:
std::auto_ptr<Impl> spImpl_; std::auto_ptr<Impl> spImpl_;
~FunctorBase() {}
}; };
// implementation class for Functor with return type = void // implementation class for Functor with return type = void
@ -1426,6 +1432,7 @@ namespace Private
} }
protected: protected:
std::auto_ptr<Impl> spImpl_; std::auto_ptr<Impl> spImpl_;
~FunctorVoidBase() {}
}; };
} }
@ -1765,8 +1772,8 @@ namespace Private
p14); p14);
} }
// VC7 BUG protected:
virtual ~BinderFirstBase() {} ~BinderFirstBase() {}
private: private:
OriginalFunctor f_; OriginalFunctor f_;
BoundType b_; BoundType b_;
@ -1860,8 +1867,8 @@ namespace Private
p14); p14);
} }
// VC7 BUG protected:
virtual ~BinderFirstVoidBase() {} ~BinderFirstVoidBase() {}
private: private:
OriginalFunctor f_; OriginalFunctor f_;
BoundType b_; BoundType b_;
@ -1998,11 +2005,6 @@ namespace Private
ChainerBase(const Fun1& fun1, const Fun2& fun2) ChainerBase(const Fun1& fun1, const Fun2& fun2)
: f1_(fun1), f2_(fun2) {} : f1_(fun1), f2_(fun2) {}
//
// VC7 don't see this implicit constructor
//
virtual ~ChainerBase() {}
// operator() implementations for up to 15 arguments // operator() implementations for up to 15 arguments
@ -2102,6 +2104,7 @@ namespace Private
protected: protected:
Fun1 f1_; Fun1 f1_;
Fun2 f2_; Fun2 f2_;
~ChainerBase() {}
}; };
@ -2132,12 +2135,6 @@ namespace Private
ChainerVoidBase(const Fun1& fun1, const Fun2& fun2) ChainerVoidBase(const Fun1& fun1, const Fun2& fun2)
: f1_(fun1), f2_(fun2) {} : f1_(fun1), f2_(fun2) {}
//
// VC7 don't see this implicit constructor
//
virtual ~ChainerVoidBase() {}
// operator() implementations for up to 15 arguments // operator() implementations for up to 15 arguments
ResultType operator()() ResultType operator()()
@ -2236,7 +2233,7 @@ namespace Private
protected: protected:
Fun1 f1_; Fun1 f1_;
Fun2 f2_; Fun2 f2_;
~ChainerVoidBase() {}
}; };
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -2329,6 +2326,7 @@ namespace Private
// Replaced the void return workaround. // Replaced the void return workaround.
// B.K. // B.K.
// Feb 25, 2003: added conversion unspecified_bool_type. 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 // FUNCTOR_INC_
#endif // #ifdef USE_FUNCTOR_OLD_VERSION #endif // #ifdef USE_FUNCTOR_OLD_VERSION

View file

@ -137,6 +137,8 @@ namespace Private
return DispatchLhs(lhs, rhs, exec, Tail()); return DispatchLhs(lhs, rhs, exec, Tail());
} }
protected:
~StaticDispatcherBase() {}
public: public:
static ResultType Go( BaseLhs& lhs, BaseRhs& rhs, static ResultType Go( BaseLhs& lhs, BaseRhs& rhs,
Executor exec) Executor exec)
@ -189,6 +191,8 @@ namespace Private
DispatchLhs(lhs, rhs, exec, Tail()); DispatchLhs(lhs, rhs, exec, Tail());
} }
protected:
~StaticDispatcherVoidBase() {}
public: public:
static ResultType Go( BaseLhs& lhs, BaseRhs& rhs, static ResultType Go( BaseLhs& lhs, BaseRhs& rhs,
Executor exec) Executor exec)
@ -209,8 +213,7 @@ namespace Private
bool symmetric = true, bool symmetric = true,
class BaseRhs = BaseLhs, class BaseRhs = BaseLhs,
class TypesRhs = TypesLhs, class TypesRhs = TypesLhs,
typename ResultType = Loki::Select< typename ResultType = Loki::Private::VoidWrap::type
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result
> >
class StaticDispatcher : public ::Loki::Select class StaticDispatcher : public ::Loki::Select
< <
@ -255,6 +258,7 @@ namespace Private
typedef CallbackType MappedType; typedef CallbackType MappedType;
typedef AssocVector<KeyType, MappedType> MapType; typedef AssocVector<KeyType, MappedType> MapType;
MapType callbackMap_; MapType callbackMap_;
~BasicDispatcherCommonBase() {}
public: public:
template <class SomeLhs, class SomeRhs> template <class SomeLhs, class SomeRhs>
void Add(CallbackType fun, ::Loki::Type2Type<SomeLhs>, void Add(CallbackType fun, ::Loki::Type2Type<SomeLhs>,
@ -295,6 +299,8 @@ namespace Private
typedef BasicDispatcherCommonBase<CallbackType> Base; typedef BasicDispatcherCommonBase<CallbackType> Base;
ResultType Go(BaseLhs& lhs, BaseRhs& rhs); ResultType Go(BaseLhs& lhs, BaseRhs& rhs);
protected:
~BasicDispatcherBase() {}
}; };
template <class BaseLhs, class BaseRhs, template <class BaseLhs, class BaseRhs,
typename ResultType, typename CallbackType> typename ResultType, typename CallbackType>
@ -320,6 +326,8 @@ namespace Private
typedef BasicDispatcherCommonBase<CallbackType> Base; typedef BasicDispatcherCommonBase<CallbackType> Base;
ResultType Go(BaseLhs& lhs, BaseRhs& rhs); ResultType Go(BaseLhs& lhs, BaseRhs& rhs);
protected:
~BasicDispatcherVoidBase() {}
}; };
template <class BaseLhs, class BaseRhs, typename CallbackType> template <class BaseLhs, class BaseRhs, typename CallbackType>
typename BasicDispatcherVoidBase<BaseLhs,BaseRhs, CallbackType>::ResultType typename BasicDispatcherVoidBase<BaseLhs,BaseRhs, CallbackType>::ResultType
@ -346,8 +354,7 @@ namespace Private
< <
class BaseLhs, class BaseLhs,
class BaseRhs = BaseLhs, class BaseRhs = BaseLhs,
typename ResultType = Loki::Select< typename ResultType = Loki::Private::VoidWrap::type,
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result,
typename CallbackType = ResultType (*)(BaseLhs&, BaseRhs&) typename CallbackType = ResultType (*)(BaseLhs&, BaseRhs&)
> >
class BasicDispatcher : public ::Loki::Select class BasicDispatcher : public ::Loki::Select
@ -440,6 +447,8 @@ namespace Private
{ {
return backEnd_.Go(lhs, rhs); return backEnd_.Go(lhs, rhs);
} }
protected:
~FnDispatcherBase() {}
}; };
template <class BaseLhs, class BaseRhs, class DispatcherBackend> template <class BaseLhs, class BaseRhs, class DispatcherBackend>
@ -453,6 +462,8 @@ namespace Private
{ {
backEnd_.Go(lhs, rhs); backEnd_.Go(lhs, rhs);
} }
protected:
~FnDispatcherVoidBase() {}
}; };
@ -470,6 +481,8 @@ namespace Private
{ {
Trampoline(lhs, rhs); Trampoline(lhs, rhs);
} }
protected:
~FnDispatcherHelperVoidBase() {}
}; };
template<typename ResultType, class BaseLhs, class BaseRhs, template<typename ResultType, class BaseLhs, class BaseRhs,
@ -486,6 +499,8 @@ namespace Private
{ {
Trampoline(lhs, rhs); Trampoline(lhs, rhs);
} }
protected:
~FnDispatcherHelperBase() {}
}; };
template template
@ -514,8 +529,7 @@ namespace Private
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class BaseLhs, class BaseRhs = BaseLhs, template <class BaseLhs, class BaseRhs = BaseLhs,
typename ResultType = Loki::Select< typename ResultType = Loki::Private::VoidWrap::type,
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result,
class CastingPolicy = DynamicCasterWrapper, class CastingPolicy = DynamicCasterWrapper,
class DispatcherBackend = BasicDispatcherWrapper> class DispatcherBackend = BasicDispatcherWrapper>
class FnDispatcher : public ::Loki::Select class FnDispatcher : public ::Loki::Select
@ -657,6 +671,7 @@ namespace Private
ApplyInnerType4<DispatcherBackend,BaseLhs, BaseRhs, ResultType, ApplyInnerType4<DispatcherBackend,BaseLhs, BaseRhs, ResultType,
FunctorType>::type backEnd_; FunctorType>::type backEnd_;
~FunctorDispatcherCommonBase() {}
}; };
template <typename ResultType, class BaseLhs, class BaseRhs, template <typename ResultType, class BaseLhs, class BaseRhs,
@ -674,6 +689,8 @@ namespace Private
{ {
return Base::backEnd_.Go(lhs, rhs); return Base::backEnd_.Go(lhs, rhs);
} }
protected:
~FunctorDispatcherBase() {}
}; };
template <class BaseLhs, class BaseRhs, class DispatcherBackend> template <class BaseLhs, class BaseRhs, class DispatcherBackend>
@ -691,7 +708,8 @@ namespace Private
{ {
Base::backEnd_.Go(lhs, rhs); Base::backEnd_.Go(lhs, rhs);
} }
protected:
~FunctorDispatcherVoidBase() {}
}; };
} }
@ -702,8 +720,7 @@ namespace Private
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class BaseLhs, class BaseRhs = BaseLhs, template <class BaseLhs, class BaseRhs = BaseLhs,
typename ResultType = Loki::Select< typename ResultType = Loki::Private::VoidWrap::type,
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result,
class CastingPolicy = DynamicCasterWrapper, class CastingPolicy = DynamicCasterWrapper,
class DispatcherBackend = BasicDispatcherWrapper> class DispatcherBackend = BasicDispatcherWrapper>
class FunctorDispatcher : public ::Loki::Select class FunctorDispatcher : public ::Loki::Select
@ -784,7 +801,8 @@ namespace Private
// Oct 28, 2002: ported by Benjamin Kaufmann to MSVC 6 // Oct 28, 2002: ported by Benjamin Kaufmann to MSVC 6
// Feb 19, 2003: replaced pointer-Dummies with Type2Type-Parameters and added // Feb 19, 2003: replaced pointer-Dummies with Type2Type-Parameters and added
// support for return type void. B.K. // 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 #endif

View file

@ -260,6 +260,8 @@ namespace Private
ASSERT_TYPELIST(TList); ASSERT_TYPELIST(TList);
virtual R Visit(typename TList::Head&) virtual R Visit(typename TList::Head&)
{ return R(); } { return R(); }
protected:
~BaseVisitorImplBase() {}
}; };
template <class TList, class R> template <class TList, class R>
@ -270,6 +272,8 @@ namespace Private
ASSERT_TYPELIST(TList); ASSERT_TYPELIST(TList);
virtual R Visit(typename TList::Head&) virtual R Visit(typename TList::Head&)
{ } { }
protected:
~BaseVisitorImplVoidBase() {}
}; };
} }
@ -292,10 +296,6 @@ namespace Private
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template DefaultCatchAll // class template DefaultCatchAll
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
namespace Private
{
}
template <typename R, typename Visited> template <typename R, typename Visited>
struct DefaultCatchAll struct DefaultCatchAll
{ {
@ -388,6 +388,8 @@ namespace Private
} }
return CatchA::OnUnknownVisitor(visited, guest); return CatchA::OnUnknownVisitor(visited, guest);
} }
~BaseVisitableBase() {}
}; };
template <class R, class CatchAll> template <class R, class CatchAll>
class BaseVisitableVoidBase class BaseVisitableVoidBase
@ -406,6 +408,7 @@ namespace Private
} }
CatchA::OnUnknownVisitor(visited, guest); CatchA::OnUnknownVisitor(visited, guest);
} }
~BaseVisitableVoidBase() {}
}; };
} }
template template
@ -456,6 +459,8 @@ namespace Private
Visitor<Visited, ReturnType>& subObj = *this; Visitor<Visited, ReturnType>& subObj = *this;
return subObj.Visit(host); return subObj.Visit(host);
} }
protected:
~CyclicVisitorBase() {}
}; };
template <class TList> template <class TList>
class CyclicVisitorVoidBase : public Visitor<TList, void> class CyclicVisitorVoidBase : public Visitor<TList, void>
@ -467,6 +472,8 @@ namespace Private
Visitor<Visited, ReturnType>& subObj = *this; Visitor<Visited, ReturnType>& subObj = *this;
subObj.Visit(host); subObj.Visit(host);
} }
protected:
~CyclicVisitorVoidBase() {}
}; };
} }
@ -505,7 +512,8 @@ namespace Private
// Oct 27, 2002: ported by Benjamin Kaufmann to MSVC 6.0 // Oct 27, 2002: ported by Benjamin Kaufmann to MSVC 6.0
// Feb 23, 2003: Removed special visitor classes for return type void. // Feb 23, 2003: Removed special visitor classes for return type void.
// Added Loki:: qualification to Accept's Paramter (in the macro) B.K. // 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_ #endif // VISITOR_INC_