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

  • SEARCH
  • Home
  • 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 8850513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:55:15+00:00 2026-06-14T12:55:15+00:00

I have a class which basically looks like this(i removed unnecessary code): class WilxList

  • 0

I have a class which basically looks like this(i removed unnecessary code):

class WilxList {
private:    
    struct Test{
        double number;
        int sign;
        int rank;
    };
    bool testSorter(const Test & x1, const Test & x2);
public: 
    WilxList(std::vector<double> &argNumbers, std::string argName, int numberOfTests);
};

I am trying to sort a vector of Test structs like that:

WilxList::WilxList(std::vector<double> &argNumbers, std::string argName, int numberOfTests)
{
    //Omitted code
    std::vector<Test> sortedTests;
    //Omitted code where Tests are created and added to the vector inside for loop
    std::sort(sortedTests.begin(), sortedTests.end(), testSorter); //ERROR

}

The error i get is:

error C3867: 'WilxList::testSorter': function call missing argument list; 
use '&WilxList::testSorter' to create a pointer to member
c:\users\stenver\documents\visual studio 2012\projects\wilxoniastakutest\wilxoniastakutest\wilxlist.cpp 
  • 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-06-14T12:55:16+00:00Added an answer on June 14, 2026 at 12:55 pm

    testSorter is a non static member function of the class WilxList which is causing the difficulty. To use function pointers to non static member functions is relatively more difficult, and is impossible to use in cases which expect a free (or static member) function like the sort algorithm.

    One option to fix this is to move testSorter into the struct itself and rename it to operator<. This will let you do stuff like x1<x2 and you can call sort as just std::sort(sortedTests.begin(), sortedTests.end()); This is assuming the function actually represents a < operation, if it isnt, it might get confusing and would be neater to just make it a static member function. The errors will go away in either case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have abstract BaseController, which basically looks like below: public abstract class BaseController :
I have code that basically looks like this (it isn't actually object, but rather
I have an observer which looks like this: class CommentObserver < ActiveRecord::Observer include ActionView::Helpers::UrlHelper
Good afternoon all, I have a class which looks like this: public class Grapheme
I've got a problem with my code. It basically looks like this: someclass.hpp: class
I have a class structure for a role playing game which looks like this...
I have this script which basically toggles a bgColor class on and off so
interesting problem: I have a Domain Class which looks like class Dummy { String
we have a very customized UITableViewCell here. So it basically looks like this: +----------------+
I'm trying to write serialization code for a class that looks like this: public

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.