template compile error

Discussion in 'C++' started by ken.carlino@gmail.com, Feb 26, 2006.

  1. Guest

    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
     
    , Feb 26, 2006
    #1
    1. Advertising

  2. 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;
    >
    > 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.
     
    Amadeus W. M., Feb 26, 2006
    #2
    1. Advertising

  3. benben Guest

    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;
    >
    > 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
    >
     
    benben, Feb 26, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Cuenca
    Replies:
    4
    Views:
    2,529
    Gianni Mariani
    Sep 6, 2004
  2. Nagaraj
    Replies:
    1
    Views:
    871
    Lionel B
    Mar 1, 2007
  3. Jeff
    Replies:
    3
    Views:
    526
  4. fAnSKyer
    Replies:
    2
    Views:
    534
    Alf P. Steinbach
    Jun 7, 2009
  5. kurt krueckeberg
    Replies:
    1
    Views:
    326
    Victor Bazarov
    Apr 29, 2013
Loading...

Share This Page