 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Feb 26, 2006 2:06 am Post subject: template compile error |
|
|
I would need some help in figuring out this compile error. Thanks in
advance for any help.
I have a template like this:
template <class T, class T1>
class Dummy {
public:
float buildList(T& tmpAreaPerCent, const T& allAreaPerCent, int no);
};
template<class T, class T1>
float Dummy<T, T1>::buildList(T& tmpAreaPerCent, const T&
allAreaPerCent, int no) {
vector<int> allItr;
allItr.push_back(0);
int size = tmpAreaPerCent.size() - 1;
allItr.push_back(size);
sort(allItr.begin(), allItr.end());
for (int i = 0; i + 1 < allItr.size() ; i++) {
int beginIndex = allItr[i];
if (i != 0) beginIndex += 1;
int endIndex = allItr[i+1];
// comment calling method here
}
return 0.0;
};
This is where I create the template:
Dummy< vector<float>, float > pmh2;
float areaStdDev = pmh2.buildList(tmpAreaPerCent, allAreaPerCent,
no);
Here is the error:
.../MatcherHelper.h: In member function 'float Dummy<T,
T1>::buildList(T&, const T&, int) [with T = std::vector<float,
std::allocator<float> >, T1 = float]':
.../Row1Matcher.cpp:41: instantiated from here
.../PatternMatcherHelper.h:36: warning: comparison between signed and
unsigned integer expressions
.../Row1Matcher.cpp:41: instantiated from here
Thank you |
|
| Back to top |
|
 |
Amadeus W. M. Guest
|
Posted: Sun Feb 26, 2006 3:06 am Post subject: Re: template compile error |
|
|
On Sat, 25 Feb 2006 17:59:20 -0800, ken.carlino wrote:
| Quote: | I would need some help in figuring out this compile error. Thanks in
advance for any help.
I have a template like this:
template <class T, class T1
class Dummy {
public:
float buildList(T& tmpAreaPerCent, const T& allAreaPerCent, int no);
};
template<class T, class T1
float Dummy<T, T1>::buildList(T& tmpAreaPerCent, const T&
allAreaPerCent, int no) {
vector<int> allItr;
allItr.push_back(0);
int size = tmpAreaPerCent.size() - 1;
allItr.push_back(size);
sort(allItr.begin(), allItr.end());
for (int i = 0; i + 1 < allItr.size() ; i++) {
int beginIndex = allItr[i];
if (i != 0) beginIndex += 1;
int endIndex = allItr[i+1];
// comment calling method here
}
return 0.0;
};
This is where I create the template:
Dummy< vector<float>, float > pmh2;
float areaStdDev = pmh2.buildList(tmpAreaPerCent, allAreaPerCent,
no);
Here is the error:
../MatcherHelper.h: In member function 'float Dummy<T,
T1>::buildList(T&, const T&, int) [with T = std::vector<float,
std::allocator<float> >, T1 = float]':
../Row1Matcher.cpp:41: instantiated from here
../PatternMatcherHelper.h:36: warning: comparison between signed and
unsigned integer expressions
../Row1Matcher.cpp:41: instantiated from here
Thank you
|
It's a warning, not an error. Go to line 36 in PatternMatcherHelper.h
(as the warning says), and see which integers you're comparing. It may or
may not matter. |
|
| Back to top |
|
 |
benben Guest
|
Posted: Sun Feb 26, 2006 3:06 am Post subject: Re: template compile error |
|
|
ken.carlino (AT) gmail (DOT) com wrote:
| Quote: | I would need some help in figuring out this compile error. Thanks in
advance for any help.
I have a template like this:
template <class T, class T1
class Dummy {
public:
float buildList(T& tmpAreaPerCent, const T& allAreaPerCent, int no);
};
template<class T, class T1
float Dummy<T, T1>::buildList(T& tmpAreaPerCent, const T&
allAreaPerCent, int no) {
vector<int> allItr;
allItr.push_back(0);
int size = tmpAreaPerCent.size() - 1;
allItr.push_back(size);
sort(allItr.begin(), allItr.end());
for (int i = 0; i + 1 < allItr.size() ; i++) {
|
for (vector<int>::size_type i = 0; ...
// vector<int>::size_type is unsigned
| Quote: | int beginIndex = allItr[i];
if (i != 0) beginIndex += 1;
int endIndex = allItr[i+1];
// comment calling method here
}
return 0.0;
};
This is where I create the template:
Dummy< vector<float>, float > pmh2;
float areaStdDev = pmh2.buildList(tmpAreaPerCent, allAreaPerCent,
no);
Here is the error:
../MatcherHelper.h: In member function 'float Dummy<T,
T1>::buildList(T&, const T&, int) [with T = std::vector<float,
std::allocator<float> >, T1 = float]':
../Row1Matcher.cpp:41: instantiated from here
../PatternMatcherHelper.h:36: warning: comparison between signed and
unsigned integer expressions
|
Isn't the above warning obvious? Go to line 36 and find out about signed
and unsigned integer.
| Quote: | ../Row1Matcher.cpp:41: instantiated from here
Thank you
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|