Skip to content

Instantly share code, notes, and snippets.

View unrays's full-sized avatar
💼
Always open for opportunities

Félix-Olivier Dumas unrays

💼
Always open for opportunities
  • Computer Science Student · Cégep de Rimouski
  • Rimouski, Québec
View GitHub Profile
@unrays
unrays / deducing_this.hpp
Last active March 4, 2026 18:02
I'm never going back, insanely generic and flexible implementation of a getter
constexpr EXOTIC_NODISCARD decltype(auto) get(this auto&& self) noexcept {
return std::forward<decltype(self)>(self);
}
@unrays
unrays / CRTPJsonDSLBuilder.hpp
Created March 1, 2026 23:56
Unfinished C++ mini-framework for type-safe JSON construction using CRTP, operator overloading, and generic lambdas.
// Copyright (c) March 2026 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file
template<template<typename> class Res, template<typename> class Dis>
struct JsonBuildingPair {
template<typename T>
using Resolver = Res<T>;
template<typename T>
using Dispatcher = Dis<T>;
@unrays
unrays / lyst.hpp
Created January 19, 2026 12:51
Header-only C++ typelist library for template metaprogramming
/*********************************************************************
* EXOTIC.lyst - Header-only C++ typelist library
*
* Copyright (c) 2026 Félix-Olivier Dumas
* All rights reserved.
*
* Licensed under the Boost Software License, Version 1.0.
* You may obtain a copy of the License at:
* https://www.boost.org/LICENSE_1_0.txt
*
@unrays
unrays / lynx.hpp
Created January 19, 2026 12:51
Header-only C++ compile-time pipeline library for DSLs
/*********************************************************************
* EXOTIC.lynx - Header-only C++ compile-time pipeline library
*
* Copyright (c) 2026 Félix-Olivier Dumas
* All rights reserved.
*
* Licensed under the Boost Software License, Version 1.0.
* You may obtain a copy of the License at:
* https://www.boost.org/LICENSE_1_0.txt
*
@unrays
unrays / alloc.cpp
Created January 19, 2026 12:51
Basic C++ template allocator example
// Copyright (c) December 2025 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file
#include <iostream>
struct Point {
int x, y;
Point(int a, int b) : x(a), y(b) {}
void print() { std::cout << "(" << x << "," << y << ")\n"; }
};
@unrays
unrays / singleton.cpp
Created January 19, 2026 12:51
Modern C++ CRTP singleton implementation
// Copyright (c) December 2025 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file
template<typename Derived>
struct Singleton {
public:
static Derived& instance() {
static Derived instance(Token{});
return instance;
}
@unrays
unrays / hook.cpp
Created January 19, 2026 12:51
Compile-time event hooks using CRTP in modern C++
// Copyright (c) December 2025 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file
template<typename Hooked>
struct IEventHookable {
protected:
IEventHookable() {
if constexpr (requires(Hooked h) { h.onCreated(); })
static_cast<Hooked*>(this)->onCreated();
else onCreatedDefault();
@unrays
unrays / unrays_printer.cpp
Last active December 10, 2025 02:44
An elegant and conceptually interesting CRTP-based C++ printer using SFINAE for compile-time static dispatch of variadic arguments.
// Copyright (c) December 2025 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file
template<typename Variation>
class IPrinter {
public:
template<typename... Args>
auto print(Args&&... args) noexcept ->
std::enable_if_t<std::is_void_v
<decltype(std::declval<Variation>().print(std::declval<Args>()...))>,
@unrays
unrays / main.cpp
Last active December 10, 2025 02:43
Sparse Set and Dense Array Template for ECS in C++ by unrays
// Copyright (c) December 2025 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file.
template<typename T>
struct Sparse {
private:
static constexpr std::size_t DEFAULT_DENSE_CAPACITY = 2048;
static constexpr std::size_t DEFAULT_SPARSE_CAPACITY = 16384;
inline void error_not_enough_capacity(const std::string& context, size_t required, size_t actual) {
@unrays
unrays / ecs.cpp
Last active December 10, 2025 02:41
High-performance C++ ECS with cache-friendly design
// Copyright (c) November 2025 Félix-Olivier Dumas. All rights reserved.
// Licensed under the terms described in the LICENSE file.
class Registry {
private:
static constexpr std::uint32_t InitialEntityCapacity = 131072;
static constexpr std::uint32_t InitialPoolCapacity = 262143;
std::vector<ComponentMask> _cmask;
std::vector<ComponentMask> _ctype;