fixed build for gcc4, from eNigMa

tested also for gcc2.95


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18914 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-09-23 22:02:21 +00:00
parent 4205612012
commit 9f6275e0e4
26 changed files with 112 additions and 81 deletions
+1
View File
@@ -47,6 +47,7 @@ SharedLibrary libqoca.so :
QcSparseMatrix.cc QcSparseMatrix.cc
QcVarStow.cc QcVarStow.cc
QcVariableBiMap.cc QcVariableBiMap.cc
QcUtility.cc
: :
$(TARGET_LIBSTDC++) $(TARGET_LIBSTDC++)
; ;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef KeyIteratorHH #ifndef KeyIteratorHH
#define KeyIteratorHH #define KeyIteratorHH
template <class Iterator, class Key> template <class Iterator, typename Key>
class KeyIterator class KeyIterator
: public Iterator : public Iterator
{ {
+10 -8
View File
@@ -3,12 +3,14 @@
#define QcBiMapDCL #define QcBiMapDCL
#line 1 "QcBiMap.ch" #line 1 "QcBiMap.ch"
#include <iostream.h> #include <iostream>
#include <map.h> #include <map>
#include <vector.h> #include <vector>
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#include "qoca/KeyIterator.hh" #include "qoca/KeyIterator.hh"
using namespace std;
/** Bi-directional one-to-one mapping between identifier class and non-negative /** Bi-directional one-to-one mapping between identifier class and non-negative
integers. integers.
@@ -24,7 +26,7 @@
template<class AKey> template<typename AKey>
class QcBiMap class QcBiMap
{ {
@@ -55,11 +57,11 @@ vAssertDeepInvar() const;
protected: protected:
typedef map<AKey, int, less<AKey> > TIdentifierMap; typedef std::map<AKey, int, less<AKey> > TIdentifierMap;
typedef vector<AKey> TIndexMap; typedef std::vector<AKey> TIndexMap;
public: public:
typedef KeyIterator<TIdentifierMap::const_iterator, AKey> const_identifier_iterator; typedef KeyIterator<typename TIdentifierMap::const_iterator, AKey> const_identifier_iterator;
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
@@ -117,7 +119,7 @@ Update(const AKey &ident, int index);
const_identifier_iterator const_identifier_iterator
getIdentifiers_begin() const getIdentifiers_begin() const
{ {
TIdentifierMap::const_iterator i = fIdentifierMap.begin(); typename TIdentifierMap::const_iterator i = fIdentifierMap.begin();
return const_identifier_iterator (i); return const_identifier_iterator (i);
} }
+12 -12
View File
@@ -1,7 +1,7 @@
//begin o[d] //begin o[d]
#include <iostream.h> #include <iostream>
#include <map.h> #include <map>
#include <vector.h> #include <vector>
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#include "qoca/KeyIterator.hh" #include "qoca/KeyIterator.hh"
//end o[d] //end o[d]
@@ -46,12 +46,12 @@ assertInvar() const
fIndexMap[ i].assertInvar(); fIndexMap[ i].assertInvar();
if(fIndexMap[ i].isDead()) if(fIndexMap[ i].isDead())
continue; continue;
TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]); typename TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]);
qcAssertInvar( f != fIdentifierMap.end()); qcAssertInvar( f != fIdentifierMap.end());
qcAssertInvar( f->second == i); qcAssertInvar( f->second == i);
} }
for(TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++) for(typename TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++)
{ {
unsigned ix = ii->second; unsigned ix = ii->second;
qcAssertInvar( ix < fIndexMap.size()); qcAssertInvar( ix < fIndexMap.size());
@@ -80,7 +80,7 @@ protected:
typedef vector<AKey> TIndexMap; typedef vector<AKey> TIndexMap;
public: public:
typedef KeyIterator<TIdentifierMap::const_iterator, AKey> const_identifier_iterator; typedef KeyIterator<typename TIdentifierMap::const_iterator, AKey> const_identifier_iterator;
//end o[d] //end o[d]
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
@@ -134,11 +134,11 @@ SwapByIndex(int i1, int i2)
fIndexMap[ i1] = ident2; fIndexMap[ i1] = ident2;
fIndexMap[ i2] = ident1; fIndexMap[ i2] = ident1;
QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1); typename QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1);
qcAssertPost( it1 != fIdentifierMap.end()); qcAssertPost( it1 != fIdentifierMap.end());
it1->second = i2; it1->second = i2;
QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2); typename QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2);
qcAssertPost( it2 != fIdentifierMap.end()); qcAssertPost( it2 != fIdentifierMap.end());
it2->second = i1; it2->second = i1;
} }
@@ -191,13 +191,13 @@ Update(const AKey &ident, int index)
unsigned GetSize() const unsigned GetSize() const
{ return fIdentifierMap.size(); } { return fIdentifierMap.size(); }
bool IdentifierPresent(AKey const &ident) const bool IdentifierPresent(AKey const &ident) const
{ return (fIdentifierMap.find(ident) != fIdentifierMap.end()); } { return (fIdentifierMap.find(ident) != fIdentifierMap.end()); }
const_identifier_iterator const_identifier_iterator
getIdentifiers_begin() const getIdentifiers_begin() const
{ {
TIdentifierMap::const_iterator i = fIdentifierMap.begin(); typename TIdentifierMap::const_iterator i = fIdentifierMap.begin();
return const_identifier_iterator (i); return const_identifier_iterator (i);
} }
@@ -220,7 +220,7 @@ Identifier(int index)
inline AKey & inline AKey &
Identifier(char const *n) Identifier(char const *n)
{ {
QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin(); typename QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin();
while(iIt != fIdentifierMap.end()) while(iIt != fIdentifierMap.end())
{ {
@@ -243,7 +243,7 @@ Identifier(char const *n)
inline int inline int
Index(AKey const &ident) const Index(AKey const &ident) const
{ {
QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident); typename QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
qcAssertPre( iIt != fIdentifierMap.end()); qcAssertPre( iIt != fIdentifierMap.end());
unsigned ix = iIt->second; unsigned ix = iIt->second;
qcAssertPost( (ix < fIndexMap.size()) qcAssertPost( (ix < fIndexMap.size())
+15 -11
View File
@@ -7,7 +7,11 @@
#line 21 "QcBiMap.ch" #line 21 "QcBiMap.ch"
#define TMPL template<class AKey> #define TMPL template<class AKey>
#if __GNUC__ >= 4
#define TYPENAMEDEF typename
#else
#define TYPENAMEDEF
#endif
@@ -23,12 +27,12 @@ QcBiMap<AKey>::assertInvar() const
fIndexMap[ i].assertInvar(); fIndexMap[ i].assertInvar();
if(fIndexMap[ i].isDead()) if(fIndexMap[ i].isDead())
continue; continue;
TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]); TYPENAMEDEF TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]);
qcAssertInvar( f != fIdentifierMap.end()); qcAssertInvar( f != fIdentifierMap.end());
qcAssertInvar( f->second == i); qcAssertInvar( f->second == i);
} }
for(TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++) for(TYPENAMEDEF TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++)
{ {
unsigned ix = ii->second; unsigned ix = ii->second;
qcAssertInvar( ix < fIndexMap.size()); qcAssertInvar( ix < fIndexMap.size());
@@ -99,11 +103,11 @@ QcBiMap<AKey>::SwapByIndex(int i1, int i2)
fIndexMap[ i1] = ident2; fIndexMap[ i1] = ident2;
fIndexMap[ i2] = ident1; fIndexMap[ i2] = ident1;
QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1); TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1);
qcAssertPost( it1 != fIdentifierMap.end()); qcAssertPost( it1 != fIdentifierMap.end());
it1->second = i2; it1->second = i2;
QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2); TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2);
qcAssertPost( it2 != fIdentifierMap.end()); qcAssertPost( it2 != fIdentifierMap.end());
it2->second = i1; it2->second = i1;
} }
@@ -127,8 +131,8 @@ QcBiMap<AKey>::Update(const AKey &ident, int index)
fIndexMap[ index] = ident; fIndexMap[ index] = ident;
// Insert ident->index mapping. // Insert ident->index mapping.
TIdentifierMap::value_type ins (ident, index); TYPENAMEDEF TIdentifierMap::value_type ins (ident, index);
typedef pair<TIdentifierMap::iterator, bool> insResultT; typedef pair<TYPENAMEDEF TIdentifierMap::iterator, bool> insResultT;
dbgPre(insResultT insResult =) dbgPre(insResultT insResult =)
fIdentifierMap.insert (ins); fIdentifierMap.insert (ins);
@@ -159,7 +163,7 @@ TMPL
inline AKey & inline AKey &
QcBiMap<AKey>::Identifier(char const *n) QcBiMap<AKey>::Identifier(char const *n)
{ {
QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin(); TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin();
while(iIt != fIdentifierMap.end()) while(iIt != fIdentifierMap.end())
{ {
@@ -179,7 +183,7 @@ TMPL
inline int inline int
QcBiMap<AKey>::Index(AKey const &ident) const QcBiMap<AKey>::Index(AKey const &ident) const
{ {
QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident); TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
qcAssertPre( iIt != fIdentifierMap.end()); qcAssertPre( iIt != fIdentifierMap.end());
unsigned ix = iIt->second; unsigned ix = iIt->second;
qcAssertPost( (ix < fIndexMap.size()) qcAssertPost( (ix < fIndexMap.size())
@@ -194,7 +198,7 @@ TMPL
inline int inline int
QcBiMap<AKey>::safeIndex(AKey const &ident) const QcBiMap<AKey>::safeIndex(AKey const &ident) const
{ {
QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident); TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
if(iIt == fIdentifierMap.end()) if(iIt == fIdentifierMap.end())
return -1; return -1;
int ix = iIt->second; int ix = iIt->second;
@@ -217,7 +221,7 @@ QcBiMap<AKey>::Print(ostream &os) const
os << i << " -> " << fIndexMap[i] << endl; os << i << " -> " << fIndexMap[i] << endl;
os << "Reverse Map:" << endl; os << "Reverse Map:" << endl;
QcBiMap<AKey>::TIdentifierMap::const_iterator itF; TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::const_iterator itF;
for (itF = fIdentifierMap.begin(); itF != fIdentifierMap.end(); ++itF) for (itF = fIdentifierMap.begin(); itF != fIdentifierMap.end(); ++itF)
os << (*itF).first << " -> " << (*itF).second << endl; os << (*itF).first << " -> " << (*itF).second << endl;
+3 -1
View File
@@ -27,10 +27,12 @@
#ifndef __QcCassSolverH #ifndef __QcCassSolverH
#define __QcCassSolverH #define __QcCassSolverH
#include <map.h> #include <map>
#include "qoca/QcDelLinInEqSystem.hh" #include "qoca/QcDelLinInEqSystem.hh"
#include "qoca/QcCassConstraint.hh" #include "qoca/QcCassConstraint.hh"
using namespace std;
class QcCassSolver : public QcDelLinInEqSystem class QcCassSolver : public QcDelLinInEqSystem
{ {
protected: protected:
+2 -1
View File
@@ -173,7 +173,8 @@
) )
#ifndef qcNoStream #ifndef qcNoStream
# include <iostream.h> # include <iostream>
using namespace std;
#endif #endif
/* TODO: Maybe use autoconf to detect this. (OTOH, I imagine that /* TODO: Maybe use autoconf to detect this. (OTOH, I imagine that
+1 -1
View File
@@ -24,7 +24,7 @@
// included with the above copyright notice. // // included with the above copyright notice. //
//============================================================================// //============================================================================//
#include <math.h> #include <cmath>
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#include "qoca/QcDelLinEqTableau.hh" #include "qoca/QcDelLinEqTableau.hh"
#ifdef qcDenseQuasiInverse #ifdef qcDenseQuasiInverse
+1 -1
View File
@@ -31,7 +31,7 @@
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#ifndef qcNoStream #ifndef qcNoStream
#include <iostream.h> #include <iostream>
#endif #endif
//#ifdef DEBUG //#ifdef DEBUG
+15 -7
View File
@@ -1,7 +1,6 @@
// Generated automatically from QcIneqSolverBase.ch by /home/pmoulder/usr/local/bin/ch2xx. // Generated automatically from QcIneqSolverBase.ch by /home/pmoulder/usr/local/bin/ch2xx.
#ifndef QcIneqSolverBaseDCL #ifndef QcIneqSolverBaseDCL
#define QcIneqSolverBaseDCL #define QcIneqSolverBaseDCL
#line 1 "QcIneqSolverBase.ch"
#include <qoca/QcSolver.H> #include <qoca/QcSolver.H>
#include <qoca/QcDelLinInEqSystem.hh> #include <qoca/QcDelLinInEqSystem.hh>
@@ -12,11 +11,24 @@ class QcIneqSolverBase
public: public:
inline inline
QcIneqSolverBase();
#line 18 "QcIneqSolverBase.ch" #line 18 "QcIneqSolverBase.ch"
QcIneqSolverBase()
: QcSolver(),
fSystem()
{
;
}
inline inline
QcIneqSolverBase(unsigned hintNumConstraints, unsigned hintNumVariables);
#line 26 "QcIneqSolverBase.ch" #line 26 "QcIneqSolverBase.ch"
QcIneqSolverBase(unsigned hintNumConstraints, unsigned hintNumVariables)
: QcSolver(),
fSystem( hintNumConstraints, hintNumVariables)
{
;
}
virtual ~QcIneqSolverBase() virtual ~QcIneqSolverBase()
{ {
} }
@@ -78,10 +90,8 @@ IsBasic(QcFloat const &v) const
virtual bool virtual bool
AddConstraint(QcConstraint &c); AddConstraint(QcConstraint &c);
#line 101 "QcIneqSolverBase.ch"
virtual bool virtual bool
AddConstraint(QcConstraint &c, QcFloat &hint); AddConstraint(QcConstraint &c, QcFloat &hint);
#line 117 "QcIneqSolverBase.ch"
virtual void virtual void
BeginAddConstraint() BeginAddConstraint()
{ {
@@ -98,10 +108,8 @@ EndAddConstraint()
virtual bool virtual bool
ChangeConstraint(QcConstraint &oldc, numT rhs); ChangeConstraint(QcConstraint &oldc, numT rhs);
#line 143 "QcIneqSolverBase.ch"
virtual bool virtual bool
RemoveConstraint(QcConstraint &c); RemoveConstraint(QcConstraint &c);
#line 159 "QcIneqSolverBase.ch"
virtual bool virtual bool
Reset() Reset()
{ {
+4 -5
View File
@@ -2,7 +2,6 @@
#include "QcIneqSolverBase.H" #include "QcIneqSolverBase.H"
#ifndef QcIneqSolverBaseIFN #ifndef QcIneqSolverBaseIFN
#define QcIneqSolverBaseIFN #define QcIneqSolverBaseIFN
#line 1 "QcIneqSolverBase.ch"
#include <qoca/QcSolver.hh> #include <qoca/QcSolver.hh>
@@ -12,11 +11,12 @@
inline /*inline
QcIneqSolverBase::QcIneqSolverBase() QcIneqSolverBase::QcIneqSolverBase()
: QcSolver(), : QcSolver(),
fSystem() fSystem()
{ {
;
} }
@@ -25,16 +25,15 @@ QcIneqSolverBase::QcIneqSolverBase(unsigned hintNumConstraints, unsigned hintNum
: QcSolver(), : QcSolver(),
fSystem( hintNumConstraints, hintNumVariables) fSystem( hintNumConstraints, hintNumVariables)
{ {
} ;
}*/
#line 80 "QcIneqSolverBase.ch"
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
// Constraint management methods // // Constraint management methods //
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
#line 173 "QcIneqSolverBase.ch"
/* /*
Local Variables: Local Variables:
mode:c++ mode:c++
+1 -1
View File
@@ -27,7 +27,7 @@
#ifndef __QcLinEqSystemH #ifndef __QcLinEqSystemH
#define __QcLinEqSystemH #define __QcLinEqSystemH
#include <vector.h> #include <vector>
#include "qoca/QcSolver.hh" #include "qoca/QcSolver.hh"
#include "qoca/QcLinEqTableau.hh" #include "qoca/QcLinEqTableau.hh"
#include "qoca/QcConstraint.hh" #include "qoca/QcConstraint.hh"
+2 -2
View File
@@ -27,8 +27,8 @@
#ifndef __QcLinEqTableauH #ifndef __QcLinEqTableauH
#define __QcLinEqTableauH #define __QcLinEqTableauH
#include <deque.h> #include <deque>
#include <vector.h> #include <vector>
#include "qoca/QcTableau.hh" #include "qoca/QcTableau.hh"
#include "qoca/QcSparseCoeff.hh" #include "qoca/QcSparseCoeff.hh"
#include "qoca/QcDelCoreTableau.hh" #include "qoca/QcDelCoreTableau.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//============================================================================// //============================================================================//
#include <math.h> #include <math.h>
#include <vector.h> #include <vector>
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#include "qoca/QcLinInEqTableau.hh" #include "qoca/QcLinInEqTableau.hh"
#include "qoca/QcConstraintIndexIterator.hh" #include "qoca/QcConstraintIndexIterator.hh"
@@ -113,7 +113,7 @@ QcOrigRowStateVector::virtualAssertLinkageInvar() const
{ {
QcOrigRowState const *state = CAST(QcOrigRowState const *, *i); QcOrigRowState const *state = CAST(QcOrigRowState const *, *i);
assert( state->fRHS == 0.0); assert( state->fRHS == 0.0);
assert( state->fMRowIndex == i - fStates); assert( state->fMRowIndex == (i - (QcState const * const *)fStates));
assert( !state->fARowDeleted); assert( !state->fARowDeleted);
} }
} }
@@ -28,11 +28,13 @@
// included with the above copyright notice. // // included with the above copyright notice. //
//============================================================================// //============================================================================//
#include <iostream.h> #include <iostream>
#include <qoca/QcQuasiRowStateVector.H> #include <qoca/QcQuasiRowStateVector.H>
#include <qoca/QcQuasiColStateVector.hh> #include <qoca/QcQuasiColStateVector.hh>
using namespace std;
class QcQuasiRowColStateVector class QcQuasiRowColStateVector
{ {
public: public:
+2 -2
View File
@@ -28,8 +28,8 @@
// included with the above copyright notice. // // included with the above copyright notice. //
//============================================================================// //============================================================================//
#include <vector.h> #include <vector>
#include <algo.h> #include <algorithm>
#include "qoca/QcConstraint.hh" #include "qoca/QcConstraint.hh"
+2 -2
View File
@@ -27,8 +27,8 @@
// included with the above copyright notice. // // included with the above copyright notice. //
//============================================================================// //============================================================================//
#include <vector.h> #include <vector>
#include <algo.h> #include <algorithm>
#include "qoca/QcConstraint.hh" #include "qoca/QcConstraint.hh"
#include <qoca/QcFixedFloatRep.hh> #include <qoca/QcFixedFloatRep.hh>
+2 -2
View File
@@ -29,8 +29,8 @@
// included with the above copyright notice. // // included with the above copyright notice. //
//============================================================================// //============================================================================//
#include <vector.h> #include <vector>
#include <algo.h> #include <algorithm>
#include "qoca/QcConstraint.hh" #include "qoca/QcConstraint.hh"
+2 -1
View File
@@ -27,7 +27,8 @@
#ifndef __QcSparseCoeffH #ifndef __QcSparseCoeffH
#define __QcSparseCoeffH #define __QcSparseCoeffH
#include <iostream.h> #include <iostream>
using namespace std;
class QcSparseCoeff class QcSparseCoeff
{ {
+1 -1
View File
@@ -27,7 +27,7 @@
#ifndef __QcSparseMatrixH #ifndef __QcSparseMatrixH
#define __QcSparseMatrixH #define __QcSparseMatrixH
#include <vector.h> #include <vector>
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#include "qoca/QcMatrix.hh" #include "qoca/QcMatrix.hh"
#include "qoca/QcSparseMatrixElement.hh" #include "qoca/QcSparseMatrixElement.hh"
+2 -2
View File
@@ -27,7 +27,7 @@
#ifndef __QcStateH #ifndef __QcStateH
#define __QcStateH #define __QcStateH
#include <iostream.h> #include <iostream>
class QcState class QcState
{ {
@@ -37,7 +37,7 @@ public:
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
// Utililty functions. // // Utililty functions. //
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
virtual void Print(ostream &os) = 0; virtual void Print(std::ostream &os) = 0;
}; };
#endif #endif
+2 -1
View File
@@ -27,7 +27,8 @@
#ifndef __QcStateVectorH #ifndef __QcStateVectorH
#define __QcStateVectorH #define __QcStateVectorH
#include <iostream.h> #include <iostream>
using namespace std;
#include "qoca/QcDefines.hh" #include "qoca/QcDefines.hh"
#include "qoca/QcState.hh" #include "qoca/QcState.hh"
+9 -8
View File
@@ -1,7 +1,7 @@
#ifndef __QcUnsortedListSetH #ifndef __QcUnsortedListSetH
#define __QcUnsortedListSetH #define __QcUnsortedListSetH
#include <vector.h> #include <vector>
#if __GNUC__ >= 4 #if __GNUC__ >= 4
template <class T, class Alloc = std::allocator<T> > template <class T, class Alloc = std::allocator<T> >
@@ -12,8 +12,8 @@ class QcUnsortedListSet
{ {
public: public:
typedef T value_type; typedef T value_type;
typedef value_type* iterator; typedef typename std::vector<T>::iterator iterator;
typedef value_type const * const_iterator; typedef typename std::vector<T>::const_iterator const_iterator;
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
typedef size_t size_type; typedef size_t size_type;
@@ -34,11 +34,12 @@ public:
{ {
} }
iterator begin() { return elements.begin(); } // TODO: This really shouldn't rely on vector's iterator type being a pointer
iterator end() { return elements.end(); } iterator begin() { return (iterator)elements.begin(); }
iterator end() { return (iterator)elements.end(); }
iterator abegin() { return elements.begin(); } iterator abegin() { return (iterator)elements.begin(); }
iterator aend() { return elements.end(); } iterator aend() { return (iterator)elements.end(); }
const_iterator abegin() const { return elements.begin(); } const_iterator abegin() const { return elements.begin(); }
const_iterator aend() const { return elements.end(); } const_iterator aend() const { return elements.end(); }
@@ -83,6 +84,6 @@ private:
(The reason for using an instance variable is so that we can control (The reason for using an instance variable is so that we can control
the interface.) */ the interface.) */
vector<T> elements; std::vector<T> elements;
}; };
#endif /* !__QcUnsortedListSetH */ #endif /* !__QcUnsortedListSetH */
+9
View File
@@ -0,0 +1,9 @@
#include <qoca/QcUtility.hh>
/* Needed for GCC4, avoids undefined references */
double const QcUtility::qcEps; // = _QC_EPS;
double const QcUtility::qcNearEps; // = 9.313225746154785e-10; // 2 ** -30
double const QcUtility::qcVaguelyNearEps; // = 9.5367431640625e-7; // 2 ** -20
double const QcUtility::qcMaxZeroVal; // = _QC_EPS * (1 - DBL_EPSILON / 2);
+8 -8
View File
@@ -60,26 +60,26 @@ public:
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
static bool IsVaguelyZero(numT val) static bool IsVaguelyZero(numT val)
{ return fabs( val) < qcVaguelyNearEps; } { return fabs( val) < QcUtility::qcVaguelyNearEps; }
static bool IsNearZero(numT val) static bool IsNearZero(numT val)
{ return fabs( val) < qcNearEps; } { return fabs( val) < QcUtility::qcNearEps; }
static bool IsZero(double val) static bool IsZero(double val)
{ return fabs( val) < qcEps; } { return fabs( val) < QcUtility::qcEps; }
static bool IsOne(double val) static bool IsOne(double val)
{ return IsZero( val - 1.0); } { return QcUtility::IsZero( val - 1.0); }
static bool IsNegative(numT val) static bool IsNegative(numT val)
{ return (val <= -qcEps); } { return (val <= -QcUtility::qcEps); }
static bool IsPositive(numT val) static bool IsPositive(numT val)
{ return (val >= qcEps); } { return (val >= QcUtility::qcEps); }
static double Zeroise(double val) static double Zeroise(double val)
{ {
return (IsZero( val) return (QcUtility::IsZero( val)
? 0.0 ? 0.0
: val); : val);
} }
@@ -87,7 +87,7 @@ public:
#ifndef NDEBUG #ifndef NDEBUG
static bool IsZeroised(double val) static bool IsZeroised(double val)
{ {
return (val == 0 || !IsZero( val)); return (val == 0 || !QcUtility::IsZero( val));
} }
#endif #endif