From 55ceebf8613c4ffe7edce5d6e6bfe4bb7fc4dd9c Mon Sep 17 00:00:00 2001 From: spog Date: Sun, 23 Apr 2006 22:32:51 +0000 Subject: [PATCH] fixed gcc 4.1 compile error git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@56 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/csg.cpp | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/radiant/csg.cpp b/radiant/csg.cpp index 34029f6b..f30fb980 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -167,12 +167,26 @@ void CSG_MakeHollow (void) SceneChangeNotify(); } +template +class RemoveReference +{ +public: + typedef Type type; +}; + +template +class RemoveReference +{ +public: + typedef Type type; +}; + template class Dereference { const Functor& functor; public: - typedef typename Functor::first_argument_type first_argument_type; + typedef typename RemoveReference::type* first_argument_type; typedef typename Functor::result_type result_type; Dereference(const Functor& functor) : functor(functor) { @@ -189,26 +203,29 @@ inline Dereference makeDereference(const Functor& functor) return Dereference(functor); } +typedef Face* FacePointer; +const FacePointer c_nullFacePointer = 0; + template Face* Brush_findIf(const Brush& brush, const Predicate& predicate) { Brush::const_iterator i = std::find_if(brush.begin(), brush.end(), makeDereference(predicate)); - return i == brush.end() ? 0 : *i; + return i == brush.end() ? c_nullFacePointer : *i; // uses c_nullFacePointer instead of 0 because otherwise gcc 4.1 attempts conversion to int } template class BindArguments1 { - typedef typename Caller::SecondArgument FirstBound; + typedef typename Caller::second_argument_type FirstBound; FirstBound firstBound; public: - typedef typename Caller::Return Return; - typedef typename Caller::FirstArgument FirstArgument; + typedef typename Caller::result_type result_type; + typedef typename Caller::first_argument_type first_argument_type; BindArguments1(FirstBound firstBound) : firstBound(firstBound) { } - Return operator()(FirstArgument firstArgument) const + result_type operator()(first_argument_type firstArgument) const { return Caller::call(firstArgument, firstBound); } @@ -217,18 +234,18 @@ public: template class BindArguments2 { - typedef typename Caller::SecondArgument FirstBound; - typedef typename Caller::ThirdArgument SecondBound; + typedef typename Caller::second_argument_type FirstBound; + typedef typename Caller::third_argument_type SecondBound; FirstBound firstBound; SecondBound secondBound; public: - typedef typename Caller::Return Return; - typedef typename Caller::FirstArgument FirstArgument; + typedef typename Caller::result_type result_type; + typedef typename Caller::first_argument_type first_argument_type; BindArguments2(FirstBound firstBound, SecondBound secondBound) : firstBound(firstBound), secondBound(secondBound) { } - Return operator()(FirstArgument firstArgument) const + result_type operator()(first_argument_type firstArgument) const { return Caller::call(firstArgument, firstBound, secondBound); } -- 2.39.2