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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:51:52+00:00 2026-05-26T23:51:52+00:00

I have a class that does an implementation of a graph (template class) in

  • 0

I have a class that does an implementation of a graph (template class) in C++ (I didn’t make this), and basically what I want to do is have a representation of Places (they are my vertices) and my edges (that link them) are distances (in miles).

I declared a simple Graph<Places *, double> places; and now I’m creating a method that checks check if a certain Place is already in the graph in order to avoid duplicates. My graph has a method Vertice<TV,TR>* findvert_content(const TV& v) const; that returns a pointer of an vertice it finds (so if that returning pointer is valid, I’m assuming it exists in the graph). Now I want to do this in my Test class:

bool Test::verifiesName(Place *place) { 
    Vertice<Place *, double> find_place = places.findvert_content(*place);
    ...
}

The problem is it gives me an semantic issue: “No viable conversion from ‘Place’ to ‘Place *const'” and I don’t know what to do from here.

Here is the code of my findvert method (for reference):

template<class TV,class TR>
Vertice<TV,TR>* Graph<TV,TR>::findvert_content(const TV& v) const
{
    Vertice<TV,TR>* ap=graf;

    while (ap != NULL)
    {
        if (ap->vcontent == v)
            return ap ;
        else 
            ap=ap->apvertice;
    }
    return ap;
}

P.S. graf is just an attribute in my Graph class: Vertice<TV,TR>* graf;.

  • 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-26T23:51:53+00:00Added an answer on May 26, 2026 at 11:51 pm

    *place is the value at the address where place points to. Are you sure you want to pass the value and not the pointer itself when you call the method? Like:

    Vertice<Place *, double> find_place = places.findvert_content(place);
    

    Also, why do you need the & if you are not modifying v inside the method? Then declare

    template<class TV,class TR>
    Vertice<TV,TR>* Graph<TV,TR>::findvert_content(const TV v) const
    

    and it should be compatible with the above call.

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

Sidebar

Related Questions

The problem is this: I have an abstract class that does some work in
I have a class that has this in the initializer: @implementation BaseFooClass -(id) init
I have a class that after it does some stuff, sends a JMS message.
I have a static util class that does some string manipulation on a bit
Using C# .NET 2.0, I have a composite data class that does have the
I have a class named toto which I send to a function that does
Does anyone have a working class or function to create the hashed email that
I have a class that I want to use to store properties for another
I have an abstract class A that define abstract methods. This means that, for
I am working on a BlackBerry j2me Java implementation that does not have the

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.