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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:01:21+00:00 2026-05-31T12:01:21+00:00

I am working on a homework assignment where we aren’t allowed to use any

  • 0

I am working on a homework assignment where we aren’t allowed to use any STL containers. My implementation of LinkedList is a collection of Nodes that are chained together with pointers. I have another class called ContinuousList which has a data member LinkedList whose Nodes contain pointers to Nodes in various other LinkedLists. I’m trying to assign the return value of a function that returns a pointer to a Node to a variable that is also a pointer to a Node, but it is saying that is invalid and I don’t understand why I can’t do that.

template <typename ValueType>
struct Node
{
    Node();
    std::string m_key;
    ValueType m_value;
    Node<ValueType>* m_next;
};

The linked list class:

template <typename ValueType>
class LinkedList
{
public:
    Node<ValueType>* begin()
    {
        return m_head;
    }
private:
    Node<ValueType>* m_head;
};

ContinuousList:

template <typename ValueType>
class ContinuousList
{
public:
    ValueType* iterate(std::string& key)
    {
        m_curr = m_collection.begin(); // Error occurs here

        ...
    }
private:
    LinkedList<Node<ValueType>*> m_collection;
    Node<ValueType>* m_curr;
};

Full error message

1>          error C2440: '=' : cannot convert from 'Node<ValueType> *' to 'Node<ValueType> *'
1>          with
1>          [
1>              ValueType=Node<bool> *
1>          ]
1>          and
1>          [
1>              ValueType=bool
1>          ]
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>          while compiling class template member function 'bool *ContinuousList<ValueType>::iterate(std::string &)'
1>          with
1>          [
1>              ValueType=bool
1>          ]
1>          see reference to class template instantiation 'ContinuousList<ValueType>' being compiled
1>          with
1>          [
1>              ValueType=bool
1>          ]
  • 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-31T12:01:22+00:00Added an answer on May 31, 2026 at 12:01 pm
        LinkedList<Node<ValueType>*> m_collection;
    

    this

    is making m_head be

          Node<Node<ValueType>*>*
    

    Which is not what you want.

        m_curr = m_collection.begin()
        Node<ValueType> = Node<Node<ValueType>*>*
    

    if

        Node<Node<ValueType>*>* 
    

    was what you wanted, use

    m_collection.begin()->m_value;

    or use

        LinkedList<ValueType>, 
    

    and it will return Node

    Though I may just be really tired…. =D

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

Sidebar

Related Questions

I'm working on a homework assignment in which I'm required to use char arrays
I'm working on a homework assignment (a project), for which one criterion is that
I'm working on a homework assignment that asks me to create a calculator that
Some classmates and I are working on a homework assignment for Java that requires
I'm working on a homework assignment that basically asks us to parse a DNS
I'm working on a homework assignment that requires me to write a program that
I'm working on this homework that's kind of confusing me... I am provided with
I am having trouble with a homework question that I've been working at for
I'm working on a homework assignment and I ran into a little snag. I'm
I am working on a homework assignment and I'm trying to figure out a

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.