Function Pointer Template Parameter and iterator_traits error
Katherine E. Price
kep@llnl.gov
Thu Mar 18 15:46:00 GMT 1999
The piece of code appended at the end of this posting results in the
following error with version egcs-2.91.66 on a SunOS5.6 machine:
> g++ Test.cc |& c++filt
/usr/ccs/bin/as: "/var/tmp/ccOmIzve.s", line 104: error: redefinition of
symbol "iterator_traits<Point *>::iterator_traits(Point *)"
/usr/ccs/bin/as: "/var/tmp/ccOmIzve.s", line 122: warning: size of
"iterator_traits<Point *>::iterator_traits(Point *)" redefined
--
// Exercise FunctionIterator Problem
#include <iterator>
using namespace std;
template<class IteratorType, class ValueType,
ValueType&
(*FuncPtr)(iterator_traits<IteratorType>::reference)>
class FunctionIterator {
public:
FunctionIterator(const IteratorType itr) : mItr(itr) {}
IteratorType mItr;
};
class Point {
public:
double x, y;
};
double& getX(Point& p) { return p.x; }
double& getY(Point& p) { return p.y; }
int main()
{
Point points[100];
FunctionIterator<Point *, double, getX> x_itr(points);
FunctionIterator<Point *, double, getY> y_itr(points);
}
--
Katherine E. Price Phone: 925-424-3141
P.O. Box 808, L-039 Email: kep@llnl.gov
Lawrence Livermore National Lab
Livermore, CA 94551-0808
More information about the Gcc-bugs
mailing list