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 2 1803
On Sat, 25 Feb 2006 17:59:20 -0800, ken.carlino wrote: 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. ke*********@gmail.com wrote: 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
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.
../Row1Matcher.cpp:41: instantiated from here
Thank you This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ben Ingram |
last post by:
Hi all,
I am writing a template matrix class in which the template parameters are
the number of rows and number of columns. There are a number of reasons
why this is an appropriate tradeoff for...
|
by: 胡岳偉(Yueh-Wei Hu) |
last post by:
Hi all,
I have 2 questions about template function as friends in template
classes. I don't know why, and hope someone could help me.
...
|
by: Yueh-Wei Hu |
last post by:
Victor Bazarov <v.Abazarov@comAcast.net> wrote in message news:
==============================================================
> > Question 1:
> >...
|
by: ranges22 |
last post by:
******************************************************************
I am compiling a librarry which has a .h file containing th
following:...
|
by: rich |
last post by:
Hi there,
I defined a class template (MyClass) and some member variables and
functions, as following:
template<class T1, class T2>
class MyClass
{
...
struct m_variable
|
by: aaragon |
last post by:
Hello all. I have a simple question that seems trivial but I can't
make it to work. I have a class that takes as a template argument,
another class. The idea is as follows:
#include...
|
by: Nick |
last post by:
I'm learning C++ and ran into a compile error using Visual C++ 2005
Express on the following example program (located at
http://www.cplusplus.com/doc/tutorial/templates.html):
// template...
|
by: Wayne Shu |
last post by:
Hi, guys
I am reading Vandevoorde and Josuttis 's "C++ Template The Complete
Guide" these days.
When I read the chapter 15: Traits and Policy classes.
I copy the code in 15.2.2 that use to...
|
by: stdlib99 |
last post by:
Hi,
I have a simple question regarding templates and meta programming.
I am going to try and work my way through the C++ Template
Metaprogramming, a book by David Abrahams and Aleksey...
|
by: QiongZ |
last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |