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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:45:04+00:00 2026-06-14T14:45:04+00:00

I am creating a small ‘generic’ pathfinding class which takes a class type of

  • 0

I am creating a small ‘generic’ pathfinding class which takes a class type of Board on which it will be finding paths,

//T - Board class type
template<class T>
class PathFinder
{...}

Whereas Board is also templated to hold the node type. (so that i can find paths on 2D or 3D vector spaces).

I would like to be able to declare and define a member function for PathFinder that will take parameters like so

//T - Board class type
PathFinder<T>::getPath( nodeType from, nodeType to);

How can I perform the type compatibility for the node type of T and nodeType that is fed into the function as parameter ?

  • 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-14T14:45:05+00:00Added an answer on June 14, 2026 at 2:45 pm

    If I understand what you want, give board a type member and use that:

    template<class nodeType>
    class board {
      public:
        typedef nodeType node_type;
      // ...
    };
    
    PathFinder<T>::getPath(typename T::node_type from, typename T::node_type to);
    

    You can also pattern match it if you can’t change board:

    template<class Board>
    struct get_node_type;
    template<class T>
    struct get_node_type<board<T> > {
      typedef T type;
    };
    
    PathFinder<T>::getPath(typename get_node_type<T>::type from, typename get_node_type<T>::type to);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a small application which will perform say 4 different, time consuming
I am creating a small utility which will help to rebuild install.php of WordPress.
I'm creating a small project which will manipulate some internal components of the project(big
I am creating small django application which holds some few questions (and answers for
I'm creating a small program which consists of a few source files on my
I'm creating a small web site that will mostly be used with modern smart
I'm creating a small solver that takes three arguments: number of hours, current time
I'm creating a small tool which let me to check status of ports of
I am creating a small application that will be deployed on Window. The database
I'm creating a small code plugin which allows you to do some things with

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.