1515#include < vector>
1616#include < functional>
1717
18- #include " LambdaRegistry .h"
18+ #include " LambdaCache .h"
1919#include " Constants.h"
2020#include " CallReflector.h"
2121#include " SetupFunction.h"
@@ -40,8 +40,6 @@ namespace rtl {
4040 using FunctionLambda = std::function < Return(_signature...) >;
4141 public:
4242
43- using lambda_t = detail::lambda_registry<_signature...>;
44-
4543 // every FunctorContainer<...> will have a unique-id.
4644 FORCE_INLINE static std::size_t getContainerId () {
4745 static const std::size_t containerId = generate_unique_id ();
@@ -62,14 +60,6 @@ namespace rtl {
6260 " (" + TypeId<_signature...>::toString () + " )" );
6361 }
6462
65-
66- static lambda_t & lambdaCache ()
67- {
68- static lambda_t lambdaRegistry;
69- return lambdaRegistry;
70- }
71-
72-
7363 private:
7464
7565 // vector holding lambdas
@@ -85,25 +75,26 @@ namespace rtl {
8575 pUpdate (lambda updating the already registered functors/ctor/d'tor set)
8676 @return: index of newly added or already existing lambda in vector 'm_functors'.
8777 */ static std::pair<std::size_t , detail::lambda_hop*> pushBack (const FunctionLambda& pFunctor,
88- std::function<const std::size_t ()> pGetIndex,
89- std::function<void(const std::size_t &)> pUpdate)
78+ std::function<const std::size_t ()> pGetIndex,
79+ std::function<void(const std::size_t &)> pUpdate)
9080 {
9181 // critical section, thread safe.
9282 static std::mutex mtx;
9383 std::lock_guard<std::mutex> lock (mtx);
9484
85+ auto & lamdba_store = lambda_cache<methodQ::None>::get<_signature...>();
9586 std::size_t index = pGetIndex ();
87+
9688 if (index == rtl::index_none)
9789 {
98- index = lambdaCache ().get ().size ();
99-
100- lambdaCache ().push (pFunctor);
90+ index = lamdba_store.get ().size ();
10191
92+ lamdba_store.push (pFunctor);
10293 getFunctorTable ().push_back (pFunctor);
10394
10495 pUpdate (index);
10596 }
106- return { index, &lambdaCache () };
97+ return { index, &lamdba_store };
10798 }
10899
109100 // friends :)
0 commit comments