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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:48:58+00:00 2026-06-14T08:48:58+00:00

Following my previous question Protected member is unknown for derived class I cannot understand

  • 0

Following my previous question
Protected member is unknown for derived class

I cannot understand which part of that line is wrong, Any idea?

There is a compile error here:

template <typename K, typename T>
bool graph<K, T>::is_edge(const K& k1, const K& k2)
{
  if (this->nod.find(k1) == this->nod.end() || this->nod.find(k2) == this->nod.end())
    throw std::string("is_edge: Node does not exist");

  if (k1 < k2) // Below line makes error: expected primary-expression!!!!
    return std::find(this->edg.begin(), this->edg.end(), edge(k1, k2)) != this->edg.end();
  return std::find(this->edg.begin(), this->edg.end(), edge(k2, k1)) != this->edg.end();
}

Or, what’s wrong with this statement:

std::find(this->edg.begin(), this->edg.end(), edge(k1, k2)) != this->edg.end();

The complete code is here, where you can test and compile it.

  • 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-14T08:48:59+00:00Added an answer on June 14, 2026 at 8:48 am

    You can resolve through the derived class to the base class like so (at least LLVM can =):

    template <typename K, typename T>
    bool graph<K, T>::is_edge(const K& k1, const K& k2)
    {
        typedef typename graph::edge edge;
    
        if (this->nod.find(k1) == this->nod.end() || this->nod.find(k2) == this->nod.end())
            throw std::string("is_edge: Node does not exist");
    
        if (k1 < k2)
            return std::find(this->edg.begin(), this->edg.end(), edge(k1, k2)) != this->edg.end();
        return std::find(this->edg.begin(), this->edg.end(), edge(k2, k1)) != this->edg.end();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following on from a previous question in which I asked: How can I use
Following my previous question: Lambda expression to access a property of an object that
Following a previous question, which was solved, I can fill multiple comboboxes with a
Following my previous question (I assume that 64-bit compiler uses only SSE instructions for
A previous question showed that fld in the following code is nil . procedure
Following my previous question , in which I think I've narrowed my problem down
Following my previous question, in which I wanted to dump all the variables in
In a comment on a previous question, someone said that the following sql statement
Following my previous question , I need to create a value consisting of a
Following on from my previous question: Simple inner join in linq How would I

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.