Pointer/iterator problem with gnu compiler.

git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@212 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
Jeongnim Kim 2005-02-23 18:14:23 +00:00
parent 85d83e25cd
commit 09afed9219
1 changed files with 4 additions and 5 deletions

View File

@ -102,13 +102,12 @@ public:
// returns a const pointer of i-th row // returns a const pointer of i-th row
inline const Type_t* operator[](unsigned int i) const { inline const Type_t* operator[](unsigned int i) const {
return X.begin() + i*D2; return &(X[0]) + i*D2;
} }
// returns a pointer of i-th row /// returns a pointer of i-th row, g++ iterator problem
inline Type_t* operator[](unsigned int i) { inline Type_t* operator[](unsigned int i) {
//return X.begin() + i*D2; return &(X[0]) + i*D2;
return &(X[0])+ i*D2;
} }
inline Type_t& operator()(unsigned int i) { inline Type_t& operator()(unsigned int i) {
@ -210,7 +209,7 @@ ostream& operator<<(ostream& out, const Matrix<T,C>& rhs)
template<class T, class C> template<class T, class C>
istream& operator>>(istream& is, Matrix<T,C>& rhs) std::istream& operator>>(std::istream& is, Matrix<T,C>& rhs)
{ {
int ii=0; int ii=0;
for(int i=0; i<rhs.size(); i++) {is >> rhs(i++);} for(int i=0; i<rhs.size(); i++) {is >> rhs(i++);}