u/Ok_Statistician_781

Toggleable Annotations for C++26 Reflection
▲ 22 r/cpp

Toggleable Annotations for C++26 Reflection

Hey all, I put together a very simple reflection utility that lets you make toggleable annotations, similarly to explicit(bool) or noexcept(bool).

Try it on Compiler Explorer!

inline constexpr rjk::flag serializable{};
inline constexpr rjk::flag skip_field{};

template <typename T>
struct [[ =serializable ]] MyType {
    int x;
    int y;

    [[ =skip_field(std::is_pointer_v<T>) ]]
    T data;
};

// serializable is applied unconditionally
static_assert(rjk::is_flag_set(^^MyType<int>, serializable));

// skip_field is applied conditionally
static_assert(not rjk::is_flag_set(^^MyType<int>::data, skip_field));
static_assert(rjk::is_flag_set(^^MyType<int*>::data, skip_field));
github.com
u/Ok_Statistician_781 — 2 days ago

HashLife Engine and Editor

Hey all, the above meta-gif is of Life in Life. I made this in my new CA editor/engine called GOLDE, which offers some convenient and snappy editor features on top of an engine with Golly’s performance. https://github.com/RyanJK5/GOLDE

I also wrote an article about GOLDE's HashLife implementation, including an exchange I had with Tomas Rokicki, the developer of Golly's HashLife engine. If anyone here is interested or has thoughts on the approach, check it out: https://ryanjk5.github.io/posts/GOLDE/

u/Ok_Statistician_781 — 3 months ago