2 Replies - 1374 Views - Last Post: 02 December 2004 - 07:43 AM Rate Topic: -----

#1 gab  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-December 04

Error Using Stl Vector - Pls Help

Posted 01 December 2004 - 08:37 PM

hi,

i'm troubled by this unknown error with STL vector. i'm simplifying my code just to illustrate the problem.

struct A
{
int a;
int aa;
};

class B
{
public: void b();
private: std::vector<A> _a;
};

void B::b()
{
A temp;
_a.push_back( temp );
}

the program crashes at b() where the push_back is done. It is an exception error. I'm using MSVS .net.

appreciate any advice.

gab

Is This A Good Question/Topic? 0
  • +

Replies To: Error Using Stl Vector - Pls Help

#2 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Re: Error Using Stl Vector - Pls Help

Posted 01 December 2004 - 10:28 PM

im using gcc 3.3.4 20040623

and get no error

This is the code i ran
#include <iostream>
#include <vector>
struct A
{int a;
int aa;};

class B
{public: void b();
private: std::vector<A> _a;};

void B::b()
{A temp;
_a.push_back( temp );}

main()
{B test;
test.b();
return 0;}


Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Error Using Stl Vector - Pls Help

Posted 02 December 2004 - 07:43 AM

Hmmm...no error here, either. And I ran Nova's code exactly on both gcc and VS.NET. Are you sure the problem wasn't eliminated when you simplified the code for posting?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1