From 1fadda98363299927a7d4e992488946f71c13594 Mon Sep 17 00:00:00 2001 From: aandrei Date: Wed, 21 Nov 2001 09:31:45 +0000 Subject: [PATCH] June 20, 2001 revision: * ported by Nick Thurn to gcc * many bug fixes git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@7 7ec92016-0320-0410-acc4-a06ded1c099a --- AbstractFactory.h | 11 +- AssocVector.h | 23 +-- EmptyType.h | 9 +- Factory.h | 9 +- Functor.h | 127 ++++++++++------- HierarchyGenerators.h | 117 +++++++++------- Mappings.h | 31 ----- MultiMethods.h | 315 ++++++++++++++++++++++++++++-------------- NullType.h | 9 +- Singleton.cpp | 11 +- Singleton.h | 60 +++++--- SmallObj.cpp | 18 ++- SmallObj.h | 20 ++- SmartPtr.h | 36 +++-- Threads.h | 9 +- Tuple.h | 2 +- TypeInfo.h | 9 +- TypeManip.h | 45 +++--- TypeTraits.h | 20 ++- Typelist.h | 30 ++-- Visitor.h | 54 +++----- main.cpp | 301 ---------------------------------------- readme.txt | 7 +- static_check.h | 25 ++-- 24 files changed, 612 insertions(+), 686 deletions(-) delete mode 100644 Mappings.h delete mode 100644 main.cpp diff --git a/AbstractFactory.h b/AbstractFactory.h index d015e43..85e19d1 100644 --- a/AbstractFactory.h +++ b/AbstractFactory.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: February 19, 2001 +// Last update: June 20, 2001 #ifndef ABSTRACTFACTORY_INC_ #define ABSTRACTFACTORY_INC_ @@ -76,7 +76,7 @@ namespace Loki typedef typename BaseProductList::Tail ProductList; public: - typedef BaseProductList::Head AbstractProduct; + typedef typename BaseProductList::Head AbstractProduct; ConcreteProduct* DoCreate(Type2Type) { return new ConcreteProduct; @@ -156,4 +156,9 @@ namespace Loki } // namespace Loki -#endif // ABSTRACTFACTORY_INC_ \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////// +// Change log: +// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +//////////////////////////////////////////////////////////////////////////////// + +#endif // ABSTRACTFACTORY_INC_ diff --git a/AssocVector.h b/AssocVector.h index 0dcc245..a593d03 100644 --- a/AssocVector.h +++ b/AssocVector.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: February 19, 2001 +// Last update: June 20, 2001 #ifndef ASSOCVECTOR_INC_ #define ASSOCVECTOR_INC_ @@ -22,7 +22,6 @@ #include #include #include -#include namespace Loki { @@ -140,7 +139,7 @@ namespace Loki } AssocVector& operator=(const AssocVector& rhs) - { AssocVector(*this).swap(*this); } + { AssocVector(rhs).swap(*this); } // iterators: // The following are here because MWCW gets 'using' wrong @@ -286,7 +285,7 @@ namespace Loki const key_type& k) const { const MyCompare& me = *this; - return std::equal_range(begin(), end(), k, me)); + return std::equal_range(begin(), end(), k, me); } friend bool operator==(const AssocVector& lhs, const AssocVector& rhs) @@ -295,10 +294,11 @@ namespace Loki return me == rhs; } - friend bool operator<(const AssocVector& lhs, const AssocVector& rhs) + bool operator<(const AssocVector& rhs) const { - const Base& me = lhs; - return me < rhs; + const Base& me = *this; + const Base& yo = rhs; + return me < yo; } friend bool operator!=(const AssocVector& lhs, const AssocVector& rhs) @@ -321,4 +321,11 @@ namespace Loki } // namespace Loki -#endif // ASSOCVECTOR_INC_ \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////// +// Change log: +// May 20, 2001: change operator= - credit due to Cristoph Koegl +// June 11, 2001: remove paren in equal_range - credit due to Cristoph Koegl +// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +//////////////////////////////////////////////////////////////////////////////// + +#endif // ASSOCVECTOR_INC_ diff --git a/EmptyType.h b/EmptyType.h index 9cd3414..5227ba8 100644 --- a/EmptyType.h +++ b/EmptyType.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: February 19, 2001 +// Last update: June 20, 2001 #ifndef EMPTYTYPE_INC_ #define EMPTYTYPE_INC_ @@ -29,4 +29,9 @@ namespace Loki class EmptyType {}; } -#endif // EMPTYTYPE_INC_ \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////// +// Change log: +// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +//////////////////////////////////////////////////////////////////////////////// + +#endif // EMPTYTYPE_INC_ diff --git a/Factory.h b/Factory.h index a668eaa..55c087b 100644 --- a/Factory.h +++ b/Factory.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: February 19, 2001 +// Last update: June 20, 2001 #ifndef FACTORY_INC_ #define FACTORY_INC_ @@ -134,4 +134,9 @@ namespace Loki }; } // namespace Loki -#endif // FACTORY_INC_ \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////// +// Change log: +// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +//////////////////////////////////////////////////////////////////////////////// + +#endif // FACTORY_INC_ diff --git a/Functor.h b/Functor.h index 01dc3e4..4c65b20 100644 --- a/Functor.h +++ b/Functor.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: February 19, 2001 +// Last update: June 20, 2001 #ifndef FUNCTOR_INC_ #define FUNCTOR_INC_ @@ -22,6 +22,7 @@ #include "EmptyType.h" #include "SmallObj.h" #include "TypeTraits.h" +#include #include namespace Loki @@ -96,6 +97,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; virtual R operator()() = 0; }; @@ -109,6 +111,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; virtual R operator()(Parm1) = 0; }; @@ -124,6 +127,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; virtual R operator()(Parm1, Parm2) = 0; @@ -140,6 +144,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -157,6 +162,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -176,6 +182,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -196,6 +203,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -217,6 +225,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -241,6 +250,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -266,6 +276,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -293,6 +304,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -322,6 +334,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -352,6 +365,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -383,6 +397,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -416,6 +431,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -450,6 +466,7 @@ namespace Loki : public Private::FunctorImplBase { public: + typedef R ResultType; typedef typename TypeTraits::ParameterType Parm1; typedef typename TypeTraits::ParameterType Parm2; typedef typename TypeTraits::ParameterType Parm3; @@ -482,22 +499,22 @@ namespace Loki typedef typename ParentFunctor::Impl Base; public: - using typename Base::ResultType; - using typename Base::Parm1; - using typename Base::Parm2; - using typename Base::Parm3; - using typename Base::Parm4; - using typename Base::Parm5; - using typename Base::Parm6; - using typename Base::Parm7; - using typename Base::Parm8; - using typename Base::Parm9; - using typename Base::Parm10; - using typename Base::Parm11; - using typename Base::Parm12; - using typename Base::Parm13; - using typename Base::Parm14; - using typename Base::Parm15; + typedef typename Base::ResultType ResultType; + typedef typename Base::Parm1 Parm1; + typedef typename Base::Parm2 Parm2; + typedef typename Base::Parm3 Parm3; + typedef typename Base::Parm4 Parm4; + typedef typename Base::Parm5 Parm5; + typedef typename Base::Parm6 Parm6; + typedef typename Base::Parm7 Parm7; + typedef typename Base::Parm8 Parm8; + typedef typename Base::Parm9 Parm9; + typedef typename Base::Parm10 Parm10; + typedef typename Base::Parm11 Parm11; + typedef typename Base::Parm12 Parm12; + typedef typename Base::Parm13 Parm13; + typedef typename Base::Parm14 Parm14; + typedef typename Base::Parm15 Parm15; FunctorHandler(const Fun& fun) : f_(fun) {} @@ -589,22 +606,22 @@ namespace Loki typedef typename ParentFunctor::Impl Base; public: - using typename Base::ResultType; - using typename Base::Parm1; - using typename Base::Parm2; - using typename Base::Parm3; - using typename Base::Parm4; - using typename Base::Parm5; - using typename Base::Parm6; - using typename Base::Parm7; - using typename Base::Parm8; - using typename Base::Parm9; - using typename Base::Parm10; - using typename Base::Parm11; - using typename Base::Parm12; - using typename Base::Parm13; - using typename Base::Parm14; - using typename Base::Parm15; + typedef typename Base::ResultType ResultType; + typedef typename Base::Parm1 Parm1; + typedef typename Base::Parm2 Parm2; + typedef typename Base::Parm3 Parm3; + typedef typename Base::Parm4 Parm4; + typedef typename Base::Parm5 Parm5; + typedef typename Base::Parm6 Parm6; + typedef typename Base::Parm7 Parm7; + typedef typename Base::Parm8 Parm8; + typedef typename Base::Parm9 Parm9; + typedef typename Base::Parm10 Parm10; + typedef typename Base::Parm11 Parm11; + typedef typename Base::Parm12 Parm12; + typedef typename Base::Parm13 Parm13; + typedef typename Base::Parm14 Parm14; + typedef typename Base::Parm15 Parm15; MemFunHandler(const PointerToObj& pObj, PointerToMemFn pMemFn) : pObj_(pObj), pMemFn_(pMemFn) @@ -840,7 +857,8 @@ namespace Loki template class ThreadingModel> struct BinderFirstTraits< Functor > { - typedef TL::Erase::Result>::Result + typedef typename TL::Erase::Result>::Result ParmList; typedef Functor BoundFunctorType; typedef typename BoundFunctorType::Impl Impl; @@ -980,22 +998,22 @@ namespace Loki typedef Fun2 Base; public: - using typename Base::ResultType; - using typename Base::Parm1; - using typename Base::Parm2; - using typename Base::Parm3; - using typename Base::Parm4; - using typename Base::Parm5; - using typename Base::Parm6; - using typename Base::Parm7; - using typename Base::Parm8; - using typename Base::Parm9; - using typename Base::Parm10; - using typename Base::Parm11; - using typename Base::Parm12; - using typename Base::Parm13; - using typename Base::Parm14; - using typename Base::Parm15; + typedef typename Base::ResultType ResultType; + typedef typename Base::Parm1 Parm1; + typedef typename Base::Parm2 Parm2; + typedef typename Base::Parm3 Parm3; + typedef typename Base::Parm4 Parm4; + typedef typename Base::Parm5 Parm5; + typedef typename Base::Parm6 Parm6; + typedef typename Base::Parm7 Parm7; + typedef typename Base::Parm8 Parm8; + typedef typename Base::Parm9 Parm9; + typedef typename Base::Parm10 Parm10; + typedef typename Base::Parm11 Parm11; + typedef typename Base::Parm12 Parm12; + typedef typename Base::Parm13 Parm13; + typedef typename Base::Parm14 Parm14; + typedef typename Base::Parm15 Parm15; Chainer(const Fun1& fun1, const Fun2& fun2) : f1_(fun1), f2_(fun2) {} @@ -1112,10 +1130,15 @@ namespace Loki const Fun1& fun1, const Fun2& fun2) { - return Fun2(std::auto_ptr( + return Fun2(std::auto_ptr( new Chainer(fun1, fun2))); } } // namespace Loki -#endif // FUNCTOR_INC_ \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////// +// Change log: +// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! +//////////////////////////////////////////////////////////////////////////////// + +#endif // FUNCTOR_INC_ diff --git a/HierarchyGenerators.h b/HierarchyGenerators.h index 2d06723..858057f 100644 --- a/HierarchyGenerators.h +++ b/HierarchyGenerators.h @@ -13,7 +13,7 @@ // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// -// Last update: February 19, 2001 +// Last update: March 05, 2001 #ifndef HIERARCHYGENERATORS_INC_ #define HIERARCHYGENERATORS_INC_ @@ -45,26 +45,30 @@ namespace Loki typedef Typelist TList; typedef GenScatterHierarchy LeftBase; typedef GenScatterHierarchy RightBase; - - template struct Rebind - { typedef Unit Result; }; + template struct Rebind + { + typedef Unit Result; + }; }; - template class Unit> - class GenScatterHierarchy : public Unit - { + template class Unit> + class GenScatterHierarchy : public Unit + { typedef Unit LeftBase; - - template struct Rebind - { typedef Unit Result; }; - }; - - template