?
Solved

Turbo C++ Container Classes

Posted on 1997-02-18
1
Medium Priority
?
643 Views
Last Modified: 2013-12-27
I seem to be having a little bit of trouble using the container class TListImp provided by Turbo C++. I have created my own typedef ListImp as an integer version of this template and I am using it in the implementation of a graph ADT. However, when I try to use the Detach member function of this class I create a general protection fault in the processor. Has anyone used this template and if so could they please offer any advice or maybe even produce a peice of example code which I may find useful?
0
Comment
Question by:Gabriel021197
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
edtmihu earned 100 total points
ID: 1598452
I don't TC. But this works with BC5.01:
#include <classlib\listimp.h>

class MyInteger
{
public:
      MyInteger() : i( 0 ) {;}
  MyInteger( int _i ) : i( _i ) {;}
  virtual ~MyInteger(){;}
      int operator == ( const MyInteger _FAR& test1 ) const { return( test1.i == i ); }
private:
      int i;
};

typedef TListImp<MyInteger> MyIntegerList;

#pragma argsused
int WINAPI WinMain(
    HINSTANCE  hInstance,      // handle of current instance
    HINSTANCE  hPrevInstance,      // handle of previous instance
    LPSTR  lpszCmdLine,      // pointer to command line
    int  nCmdShow       // show state of window
   )
{
      MyIntegerList list;
  int i;
  for ( i = 0; i < 1000; i++ )
        {
        list.Add( MyInteger( i ) );
    }
  for ( i = 0; i < 1000; i+=2 )
        {
        list.Detach( MyInteger( i ) );
    }
  return( 0 );
}

Regards Michael
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

pc, laptop  monitor connection configurations
In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question