Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:38:32+00:00 2026-05-24T04:38:32+00:00

If I compile the code below, I get an Error C2064: term does not

  • 0

If I compile the code below, I get an

“Error C2064: term does not evaluate to a function taking 2 arguments”

in the doOpp() method. If I change q = f(p, i); for q = add(p, i); everything compiles fine (with add() being the second argument in the doOpp() method). I’ve tried a couple of solutions but nothing seems to work out.

template <class T = double>
class Points {
public: 
    Points(void);
    Points(Point3d<T> *, int);
    Points(T *, int);
    Points(Points &);
    ~Points(void);

    void clear();
    int size();
    void push_back(Point3d<T> &);
    typename vector<Point3d<T>>::iterator begin(void){return pnts.begin();};
    typename vector<Point3d<T>>::iterator end(void){return pnts.end();};

    void assign(Point3d<T> *, int);
    void assign(T *, int);
    void assign(Points &);

    Points valid(void);
    Points valid(int *);
    bool setValid(int, bool);
    int validSize();

// Pointer to operator function prototype
    typedef Point3d<T> (__thiscall Points<T>::*oppFunc) (Points<T> &, int);

    Points operator=(Points &);

// + Operator method
    Points operator+(Points &p){return doOpp(p, &Points<T>::add);};
    Points operator-(Points &){return doOpp(p, &Points<T>::sub);};
    Points operator*(Points &){return doOpp(p, &Points<T>::mlt);};;

private:

    Points(int);
    void assign(int);
    int assign(Points &, Points &);
    vector<Point3d<T>> pnts;
    bool isSameSize(Points<T> &, char *);

// General purpose operator function
    Points doOpp(Points<T> &, oppFunc);

// Addition method called by doOpp
    Point3d<T> add(Points &p, int i) {return pnts[i] + p.pnts[i];}
    Point3d<T> sub(Points &p, int i) {return pnts[i] - p.pnts[i];}
    Point3d<T> mlt(Points &p, int i) {return pnts[i] * p.pnts[i];}
};

template <class T> int
Points<T>::assign(Points &p1, Points &p2) {
    int s = min(p1.size(), p2.size());
    assign(s);

    return s;
}

template <class T> bool
Points<T>::isSameSize(Points &p, char *s) {
    bool    same = (pnts.size() == p.pnts.size());

    #ifndef POINTS_NO_THROW
    if (!same) {
        PointsException e;
        e.setMessage((string) s + " source sizes not equal");
        throw e;
    }
    #endif

    return same;
}

template <class T> Points<T>
Points<T>::doOpp(Points &p, oppFunc f) {
    isSameSize(p, __FUNCTION__);
    Points<T>   r;
    int         s = r.assign(*this, p);
    Point3d<T>  q;

    for (int i = 0; i < s; i++) {
        q = f(p, i); // Causes error C2064 but q = add(p, i); works fine
    }

    return r;
}


int
main () {
    Points<>    p, q;

    q.assign(a, 4);
    p = q + q;

    return 1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:38:33+00:00Added an answer on May 24, 2026 at 4:38 am

    Since oppFunc f is a member function pointer you should use the special syntax to make a call through a member function pointer:

    q = (this->*f)(p, i);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.