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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:10:46+00:00 2026-06-19T01:10:46+00:00

In my main method, the following code has an error at the line containing

  • 0

In my main method, the following code has an error at the line containing the insertion.

hashTable<string, pair<string, string>> friendsHash = hashTable<string, pair<string, string>>(friendTotal);
        if(critChoice == 1)
        {
            for(int counter = 0; counter < friendTotal; counter ++)
            {
                string name = friends[counter].getName();
                string date = friends[counter].getBirthDate();
                string homeTown = friends[counter].getHomeTown();
                friendsHash.insert(pair<name, pair<date, homeTown>>);
            }
        }

The hashMap’s insertion function is as follows:

template<class K, class E>
void hashTable<K, E>::insert(const pair<const K, E>& thePair)
{
    int b = search(thePair.first);

    //check if matching element found
    if(table[b] == NULL)
    {
        //no matching element and table not full
        table[b] = new pair<const K, E> (thePair);
        dSize ++;
    }
    else
    {//check if duplicate or table full
        if(table[b]->first == thePair.first)
        {//duplicate, change table[b]->second
            table[b]->second = thePair.second;
        }
        else //table is full
            throw hashTableFull();
    }
}

The error is that each of the 3 arguments in the insertion function call is not a valid template type argument for 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-19T01:10:47+00:00Added an answer on June 19, 2026 at 1:10 am

    You are muddling the syntax for instantiating a class template to get a type, with that for instantiating a type to get an object.

    pair<name, pair<date, homeTown>>
    

    should be

    make_pair(name, make_pair(date, homeTown))
    

    or if you can use C++11

    {name, {date, homeTown}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code gives me the error: The best overloaded method match for 'System.Xml.Linq.XElement.XElement(System.Xml.Linq.XName,
The following line of javascript gets a Uncaught TypeError: Object #Text has no method
In the following code: private static void Main(string[] args) { var listy = new
My Java class contains the following methods: public static void main(String[] argv) //start the
My main method: public static void main(String[] args) { Scanner input = new Scanner(System.in);
I am using jdk 1.6 My main method : exmp3<String , Integer> exmp3 =
The following F# code declares base and descendant classes. The base class has a
I want to replicate the following c code in python ctypes: main() { long
The code at the bottom of this post is triggered by the following line
Strangely I am getting compilation error in C++ for the following code. class 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.