Skip to content

Commit ae64053

Browse files
committed
resolved conflicts
2 parents 52b5fb7 + ded495c commit ae64053

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

RTLBenchmarkApp/src/BenchMark.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
#include "RTLibInterface.h"
66

7-
#include <streambuf>
8-
97
#if defined(_MSC_VER)
108
# define NOINLINE __declspec(noinline)
119
#elif defined(__GNUC__)
@@ -32,7 +30,7 @@ namespace rtl_bench
3230
result = result + result;
3331
result = result + result;
3432
g_msg = pMsg;
35-
return str_type(pMsg);
33+
return str_type(g_msg->c_str());
3634
}
3735

3836
struct Node
@@ -51,7 +49,7 @@ namespace rtl_bench
5149
result = result + result;
5250
result = result + result;
5351
g_msg = pMsg;
54-
return pMsg;
52+
return str_type(g_msg->c_str());
5553
}
5654
};
5755

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#pragma once
2+
3+
#include "RObjectBuilder.hpp"
4+
5+
namespace rtl::detail
6+
{
7+
template<class _retT, class... _signature>
8+
struct LambdaFunction
9+
{
10+
using Invoker = _retT(*)(void* , _signature&...);
11+
12+
Invoker m_invoker = nullptr;
13+
void* m_storage = nullptr;
14+
15+
template<class _returnType>
16+
void init(_returnType(*pFunctor)(_signature...))
17+
{
18+
struct Holder {
19+
20+
using Functor = decltype(pFunctor);
21+
Functor m_functor;
22+
23+
Holder(Functor pFptr) : m_functor(pFptr) { }
24+
};
25+
26+
static auto holder = Holder{ pFunctor };
27+
m_storage = &holder;
28+
29+
m_invoker = +[](void* stor, _signature&... params) -> _retT {
30+
31+
auto h = static_cast<Holder*>(stor);
32+
return (h->m_functor)(params...);
33+
};
34+
}
35+
36+
_retT operator()(_signature&... params)
37+
{
38+
return m_invoker(m_storage, params...);
39+
}
40+
};
41+
}

0 commit comments

Comments
 (0)