template compile error

K

ken.carlino

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;

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
 
A

Amadeus W. M.

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;

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.
 
B

benben

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 said:
int beginIndex = allItr;

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top