B
Barry
Hi, I have the following simple code -
#include <iostream>
#include "Event.h"
int main()
{
{
Event event;
std:air<double,Event>(0.1,event);
}
std::cin.get();
return 0;
}
#ifndef EVENT_H
#define EVENT_H
#include <iostream>
class Event
{
public:
Event(void);
virtual ~Event(void);
};
#endif
#include "Event.h"
Event::Event()
{
std::cout << "Event()" << std::endl;
}
Event::~Event()
{
std::cout << "~Event()" << std::endl;
}
Why is the output as follows -
Event()
~Event()
~Event()
Since pair takes a reference to my event object, I don't see how there
can be a second object to destroy. Can anyone explain please?
Thanks,
Barry
#include <iostream>
#include "Event.h"
int main()
{
{
Event event;
std:air<double,Event>(0.1,event);
}
std::cin.get();
return 0;
}
#ifndef EVENT_H
#define EVENT_H
#include <iostream>
class Event
{
public:
Event(void);
virtual ~Event(void);
};
#endif
#include "Event.h"
Event::Event()
{
std::cout << "Event()" << std::endl;
}
Event::~Event()
{
std::cout << "~Event()" << std::endl;
}
Why is the output as follows -
Event()
~Event()
~Event()
Since pair takes a reference to my event object, I don't see how there
can be a second object to destroy. Can anyone explain please?
Thanks,
Barry