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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:24:07+00:00 2026-06-12T20:24:07+00:00

Im attempting to throw an EmptyListException when my linked list is empty, but the

  • 0

Im attempting to throw an EmptyListException when my linked list is empty, but the program keeps terminating if i uncomment the throw EmptyListException().
this is my EmptyListException header

#ifndef EMPTYLISTEXCEPTION_H
#define EMPTYLISTEXCEPTION_H

#include <stdexcept>
using std::out_of_range;
class EmptyListException : public out_of_range
{
    public:
        EmptyListException(): out_of_range("Empty List!\n") {}

};

#endif // EMPTYLISTEXCEPTION_H

— Throw command in Clist.h

template <typename E>
E Clist<E>::Remove() throw()
{
    if(isEmpty())
    {
        cout << "Empty List, no removal";
        //throw EmptyListException();
        return '.';
    }
        ... code
}

— catch in Main

try{
    cout << list->Remove() << endl;
} catch(EmptyListException &emptyList)
{
    cout << "Caught :";
    cout << emptyList.what() << endl;
}

The error ‘This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information.

  • 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-12T20:24:08+00:00Added an answer on June 12, 2026 at 8:24 pm

    Well, you told the compiler that you will not throw any exceptions from your Remove()! When you violate this promise it terminates the program. Get rid of throw() in the function declaration and try again.

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

Sidebar

Related Questions

I am attempting to interop to this simple scala code, but am having some
Perhaps this is more of an IIS question than programming, but I'll throw it
I'm attempting to create a PriorityQueue class in Java implemented via a Linked List.
I'm attempting to throw an exception using php 5.3.2 and it is giving me
Attempting to use the data series from this example no longer passes the JSONLint
Take a UITableViewCell's imageView's frame property, attempting to set it perfectly valid (doesn't throw
I'm attempting to debug an R program, and I'm sorely missing the stop if
As the title says, when attempting to do folder.open() it fails, doesn't throw an
I'm trying to throw together a quick little program using Alchemy Websockets which uses
I'm attempting to follow this series of articles . I'm between parts 2 and

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.