externing the list correctly

This commit is contained in:
sergiotarxz 2022-08-02 07:37:27 +02:00
parent 5e0d6e43fc
commit f14be05d83
4 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,4 @@
#include "elfspy/Call.h"
#include "elfspy/Fake.h"
namespace spy
{

View File

@ -4,6 +4,7 @@
#include "elfspy/Lambda.h"
#include <memory>
#include <vector>
namespace spy
{
@ -19,7 +20,16 @@ namespace spy
class FakeI {
};
extern std::vector<std::shared_ptr<FakeI>> fake_list;
extern std::vector<FakeI *> fake_list;
void delete_mocks (void) {
while (fake_list.size () != 0) {
auto index = fake_list.size () - 1;
auto element = fake_list[index];
fake_list.erase (fake_list.begin() + index);
delete element;
}
}
template <typename H, typename ReturnType, typename... ArgTypes>
class Fake : FakeI
{

View File

@ -1,6 +1,8 @@
#ifndef ELFSPY_LAMBDA_H
#define ELFSPY_LAMBDA_H
#include <utility>
namespace spy
{

View File

@ -11,6 +11,7 @@ sources = [
'GOTEntry.cpp',
'Fail.cpp',
'MFile.cpp',
'Fake.cpp',
]
headers = [