Changed default values for return types to void

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@113 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
humesikkins 2003-03-05 23:39:15 +00:00
parent 0bd2e6d699
commit 658f65d3d3
2 changed files with 86 additions and 79 deletions

View file

@ -13,7 +13,8 @@
// without express or implied warranty. // without express or implied warranty.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Last update: Feb 19, 2003 // Last update: Mar 06, 2003
// All dispatchers now have void as default value for return types.
// All dispatchers now support void as return type. // All dispatchers now support void as return type.
// //
// //
@ -208,7 +209,8 @@ namespace Private
bool symmetric = true, bool symmetric = true,
class BaseRhs = BaseLhs, class BaseRhs = BaseLhs,
class TypesRhs = TypesLhs, class TypesRhs = TypesLhs,
typename ResultType = int typename ResultType = Loki::Select<
Loki::Private::AlwaysFalse<BaseLhs>::value, void, void>::Result
> >
class StaticDispatcher : public ::Loki::Select class StaticDispatcher : public ::Loki::Select
< <
@ -344,7 +346,8 @@ namespace Private
< <
class BaseLhs, class BaseLhs,
class BaseRhs = BaseLhs, class BaseRhs = BaseLhs,
typename ResultType = int, typename ResultType = Loki::Select<
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
@ -511,7 +514,8 @@ namespace Private
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class BaseLhs, class BaseRhs = BaseLhs, template <class BaseLhs, class BaseRhs = BaseLhs,
typename ResultType = int/*void*/, typename ResultType = Loki::Select<
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
@ -698,7 +702,8 @@ namespace Private
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class BaseLhs, class BaseRhs = BaseLhs, template <class BaseLhs, class BaseRhs = BaseLhs,
typename ResultType = int/*void*/, typename ResultType = Loki::Select<
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
@ -776,9 +781,10 @@ namespace Private
// 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)
// Oct 28, 2002: ported by Benjamin Kaufmann // 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. // support for return type void. B.K.
// Mar 06, 2003: Changed default values for return types to void B.K.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif #endif

View file

@ -13,7 +13,10 @@
// without express or implied warranty. // without express or implied warranty.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Last update: Feb 23, 2003 // Last update: Mar 06, 2003
//
// Like the original library, this port now uses void as
// default value for return types.
// //
// This new of visitor.h handles void returns transparently. See // This new of visitor.h handles void returns transparently. See
// readme.txt for an explanation of the used technique. // readme.txt for an explanation of the used technique.
@ -25,9 +28,6 @@
// visitor classes for the return type void, define the macro // visitor classes for the return type void, define the macro
// USE_VISITOR_OLD_VERSION. // USE_VISITOR_OLD_VERSION.
// //
// The MSVC 6.0 does not allow void to be a default value for a template parameter.
// I therefore changed all defaults to int.
#ifdef USE_VISITOR_OLD_VERSION #ifdef USE_VISITOR_OLD_VERSION
#include "VisitorOld.h" #include "VisitorOld.h"
#else #else
@ -56,7 +56,7 @@ namespace Loki
// class template Visitor // class template Visitor
// The building block of Acyclic Visitor // The building block of Acyclic Visitor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class T, typename R = int/* = void */ > template <class T, typename R = Loki::Private::VoidWrap::type >
class Visitor; class Visitor;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template Visitor (specialization) // class template Visitor (specialization)
@ -204,7 +204,8 @@ namespace Private
// functions) // functions)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <class TList, typename R = int /* = void */ > class BaseVisitorImpl; template <class TList, typename R = Loki::Private::VoidWrap::type >
class BaseVisitorImpl;
namespace Private namespace Private
{ {
template <unsigned int ListTag> template <unsigned int ListTag>
@ -358,7 +359,7 @@ struct DefaultCatchAllWrapper
}; };
template <class TList, typename R = int /* = void */> template <class TList, typename R = Loki::Private::VoidWrap::type>
class NonStrictVisitor class NonStrictVisitor
: public GenLinearHierarchy< : public GenLinearHierarchy<
TList, TList,
@ -369,7 +370,6 @@ struct DefaultCatchAllWrapper
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template BaseVisitable // class template BaseVisitable
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
namespace Private namespace Private
{ {
template <class R, class CatchAll> template <class R, class CatchAll>
@ -382,7 +382,7 @@ namespace Private
{ {
typedef ApplyInnerType2<CatchAll, R, T>::type CatchA; typedef ApplyInnerType2<CatchAll, R, T>::type CatchA;
// 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);
} }
@ -399,7 +399,7 @@ namespace Private
{ {
typedef ApplyInnerType2<CatchAll, R, T>::type CatchA; typedef ApplyInnerType2<CatchAll, R, T>::type CatchA;
// Apply the Acyclic Visitor // Apply the Acyclic Visitor
if (Visitor<T, void>* p = dynamic_cast<Visitor<T, void>*>(&guest)) if (Visitor<T>* p = dynamic_cast<Visitor<T>*>(&guest))
{ {
p->Visit(visited); p->Visit(visited);
return; return;
@ -410,7 +410,7 @@ namespace Private
} }
template template
< <
typename R = int/* = void */, typename R = Loki::Private::VoidWrap::type,
class CatchAll = DefaultCatchAllWrapper class CatchAll = DefaultCatchAllWrapper
> >
class BaseVisitable : public Select<Private::IsVoid<R>::value, class BaseVisitable : public Select<Private::IsVoid<R>::value,
@ -505,6 +505,7 @@ 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.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // VISITOR_INC_ #endif // VISITOR_INC_