C++23: Flat Containers

C++23 的周期里又补充了四个非常重要的容器,这应该是继 C++11 加入 unordered_{map|set} 以来, 终于再次向 STL 里增加的容器。这四个容器是其实就是 map/set/multimap/multiset 的 flat 版本。 flat_map flat_set flat_multimap flat_multiset 1 Speci

Deducing This

1 What is deducing this? A new way of declaring non-static member functions that will allow for deducing the type and value category of the class instance parameter while still being invocable with regular member function syntax. 简单的说,就是让非静态成员函数的 this 参数成为一个显式参数。而不破坏以

Stateful Metaprogramming

1 Stateful MetaprogrammingA C++ trick is known as “stateful metaprogramming”, in which one manipulates friend functions and template instantiation to introduce a utilizable state into the compilation. 1 2 3 4 5 6 constexpr bool func() { /* something */ } constexpr bool a = func(); constexpr bool b = func(); // Think this assertion always fails? With stateful metaprogramming, think again. static_assert(a != b); Maybe ill-formed? or UB?

2020 总结

0.1 0x01平时其实都没有写类似年终总结这类东西的习惯的,但是今年就想了想,还是想搞点什么东西。 或者是记下来我这个和平时也没啥区别的一年? 不过