Browse Source

perf: c++0x standard functions

master
Dnomd343 2 years ago
parent
commit
bb9cda04d5
  1. 3
      src/core/core.h
  2. 6
      src/fast_cal/fast_cal.cc

3
src/core/core.h

@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <utility>
#include <functional>
#define UP (-4 * 3)
@ -13,7 +14,7 @@ public:
typedef std::function<void(uint64_t, uint64_t)> release_t;
void next_step(uint64_t code, uint64_t mask);
explicit Core(release_t release_func) : release(release_func) {}
explicit Core(release_t release_func) : release(std::move(release_func)) {}
private:
struct cache_t {

6
src/fast_cal/fast_cal.cc

@ -11,7 +11,9 @@ void FastCal::fast_cal(uint64_t code) {
std::cout << RawCode(code).dump_case() << std::endl;
auto core = Core(
std::bind(&FastCal::add_new_case, this, std::placeholders::_1, std::placeholders::_2)
[this](auto &&p1, auto &&p2) {
add_new_case(std::forward<decltype(p1)>(p1), std::forward<decltype(p2)>(p2));
}
);
cases.empty();
@ -60,7 +62,7 @@ void FastCal::add_new_case(uint64_t code, uint64_t mask) {
.code = code,
.mask = mask,
.last = cache.front(),
};;
};
cache.emplace(&cases[code]);
}

Loading…
Cancel
Save