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 3332274
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:40:15+00:00 2026-05-17T23:40:15+00:00

Here’s a template I made. I believe it is self-explanatory template <class N, class

  • 0

Here’s a template I made. I believe it is self-explanatory

   template <class N, class I>
    std::list<N*> selectiveList(I element, std::list<N*> & container, I (N::*f)() const) {
 typename std::list<N*>::iterator it;

 std::list<N*> selectiveListing;

 for (it = container.begin(); it != container.end(); ++it)
  if ((*it)->*f == element)
   selectiveListing.push_back(*it);

 if (selectiveListing.size() == 0)
  throw NoItemsFound<I>(element);

 return selectiveListing;
}

I call it from this function:

void AirportManager::searchAirplanesTypes() {
 clrscr();
 std::stringstream prompt;
 prompt  <<  "Escolha atributo a pesquisar: \n" <<
    "1) Tipo\n" <<
    "2) Descricao\n" << "3) Categoria\n";

 int choice = getNumberInput(prompt.str(), 1, 3);

 switch (choice) {
 case 1: {
  std::string searchElement1 = getStringInput("Tipo: ");
  pageNav(selectiveList(searchElement1, airport.airplanesTypes,
    &AirplaneType::getType), "", true, true);
  break;
 }
 case 2: {
  std::string searchElement2 = getStringInput("Descricao: ");
  pageNav(selectiveList(searchElement2, airport.airplanesTypes,
    &AirplaneType::getDescription), "", true, true);
  break;
 }
 case 3: {
            //Category is an enumerated data type
  Category searchElement3 = getCategoryInput("Categoria: ");
  pageNav(selectiveList(searchElement3, airport.airplanesTypes,
    &AirplaneType::getCategory), "", true, true);
  break;

 }
 }
}

I really can’t see anything wrong. Yet when I compile it, here’s what happens:

In file included from ..\src\AirportManager.cpp:14:0:
..\src\/headers/Template.h: In function 'std::list<N*> selectiveList(I, std::list<N*>&, I (N::*)()const) [with N = AirplaneType, I = std::basic_string<char>]':
..\src\AirportManager.cpp:1259:34:   instantiated from here
..\src\/headers/Template.h:340:3: error: invalid use of non-static member function
..\src\/headers/Template.h: In function 'std::list<N*> selectiveList(I, std::list<N*>&, I (N::*)()const) [with N = AirplaneType, I = Category]':
..\src\AirportManager.cpp:1265:31:   instantiated from here
..\src\/headers/Template.h:340:3: error: invalid use of non-static member function

These are a bit random. I can’t see how statics come into play here. All the getters referenced are simple const returns.

I’d be happy to get some input.

  • 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-17T23:40:15+00:00Added an answer on May 17, 2026 at 11:40 pm

    if (((*it)->*f)() == element)

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