MoYi123 最近的时间轴更新
MoYi123's repos on GitHub
Python · 10 人关注
mmooyyii
my note
Erlang · 5 人关注
trueskill
Erlang implementation of classic TrueSkill and TrueSkill2
Erlang · 3 人关注
emoji
a emoji dictionary for erlang
Go · 2 人关注
fst
Finite State Transducer
Erlang · 1 人关注
recordis
erlang redis orm
0 人关注
aho-corasick
aho corasick algorithm
Go · 0 人关注
excel_oj
Excel 在线测试平台(大家一起来内卷)
Erlang · 0 人关注
fibheap
Fibonacci heap for erlang
C · 0 人关注
pg_plugin_demo
Go · 0 人关注
practise_db
练习用数据库
Erlang · 0 人关注
ra
A Raft implementation for Erlang and Elixir that strives to be efficient and make it easier to use multiple Raft clusters in a single system.
Erlang · 0 人关注
recon
Collection of functions and scripts to debug Erlang in production.
C · 0 人关注
streamvbyte
Fast integer compression in C using the StreamVByte codec
0 人关注
trueskill-1
Python implementation of TrueSkill player ranking
Go · 0 人关注
WritingAnInterpreterInGo
Writing An Interpreter In Go
Erlang · 0 人关注
x
0 人关注
zheap
new heap with in-place update, powered by undo, for eventual integration into PostgreSQL
MoYi123

MoYi123

V2EX 第 469223 号会员,加入于 2020-02-14 14:02:50 +08:00
今日活跃度排名 4444
MoYi123 最近回复了
react 的是人写的.
go 的这个文档是通过代码里的注释直接生成的, 我从来不看这玩意.
只是高频更新不会导致死锁, 建议先把死锁的问题修好再看.
15 天前
回复了 rednose1037 创建的主题 C++ mac clion 调试怎么才能看到 stl 容器的值
lldb 和 gdb 和确定是不是 clion 的错误也没什么关系啊,
(lldb) print a
(std::unordered_map<int, std::vector<int> >) size=1 {
[0] = {
__cc_ = {
first = 1
second = size=3 {
[0] = 1
[1] = 2
[2] = 3
}
}
}
}

如果 lldb 能这样成功打印, 那肯定是 clion 的错误了, 直接找 jetbrains 就行了.
19 天前
回复了 rednose1037 创建的主题 C++ mac clion 调试怎么才能看到 stl 容器的值
直接用 gdb terminal print 能打印出来吗? 先确定一下是 gdb 的问题还是 clion 的.

如果确定是 clion 的问题, 可以找 jetbrains 的人帮你,
我之前也遇到过 clion 里的 gdb 有错误, 但是 gdb print 是好的, 后来删了一个 tmp 下的缓存文件就好了.
https://youtrack.jetbrains.com/issue/CPP-41050/Debugging-with-GDB-in-remote-toolchains-is-broken-by-CLion-update
28 天前
回复了 Niner 创建的主题 Java update 大家会允许这样写吗?
没并发问题吧, 这里只是用了一个比较蠢的办法去构造了 User u 而已.
35 天前
回复了 aqtata 创建的主题 C++ 这种情况如何消除几百个 if/else
想要酷可以参考 std::visit 的做法. 编译期生成一个 Invoke_array, 下面的例子是从运行期的 int 转特定类型到 lambda 中的例子. 稍微改改就能用于你的需求.

using namespace std;

constexpr std::array cached_type_ints = {1};

struct void_ptr {
int type;
void *ptr;
};

template <int T> struct Int2Type;

template <> struct Int2Type<1> {
using type = int;
};

template <typename Func, typename> class Visitor;

template <typename Func, std::size_t... pos>
class Visitor<Func, std::index_sequence<pos...>> {
public:
using return_type =
std::invoke_result_t<Func, Int2Type<cached_type_ints[0]>::type *>;
using fn_type = return_type (*)(Func &&, void *);

template <int16_t type_int>
static auto func_wrapper(Func &&func, void *ptr) -> return_type {
using real_type = typename Int2Type<type_int>::type;
return func(static_cast<real_type *>(ptr));
}

static auto visit(Func &&func, const void_ptr &item) -> return_type {
constexpr static std::array<fn_type, cached_type_ints.size()> invoke_map = {
func_wrapper<cached_type_ints[pos]>...};

size_t idx = std::ranges::lower_bound(cached_type_ints.begin(),
cached_type_ints.end(), item.type) -
cached_type_ints.begin();
if (idx >= invoke_map.size() or cached_type_ints[idx] != item.type)
[[unlikely]] {
throw std::bad_variant_access();
}
return invoke_map[idx](std::forward<Func>(func), item.ptr);
}
};

template <typename Func> auto visit(Func &&func, const void_ptr &item) {
using visitor = Visitor<decltype(func),
std::make_index_sequence<cached_type_ints.size()>>;
return visitor::visit(std::forward<Func>(func), item);
}

inline auto usage() {
auto item = void_ptr{.ptr = new int(1), .type = 1};
visit(
[](auto *ptr) {
print(*ptr);
delete ptr;
},
item);
}
37 天前
回复了 cj323 创建的主题 程序员 函数式编程适不适合游戏开发
用 erlang/elixir 的很大一部分是做游戏后端的.
问数据库优化的问题不贴 explain 就算了, 现在连 sql 都没有了.
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1080 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 18:46 · PVG 02:46 · LAX 10:46 · JFK 13:46
Developed with CodeLauncher
♥ Do have faith in what you're doing.