Restructure into umbrella modules (~55 -> 16 targets)

Headers move, CMake targets merge, C++ namespaces stay unchanged:
- Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant
- Functional: Pipeline, Either, Result, Retry
- Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval
- Math: +Matrix, Numeric, Random, Histogram
- Text: Str, Format, Tokenizer, Diff, Encoding, Semver
- Data: Json, Csv, Ini
- Async: Coro, Concurrency, EventBus, Observable
- Time: +Bench
- Log: Log facade + Logging framework (facade now header-only, breaking
  the Stacktrace<->Log link cycle the merge would have created)
- System: FileSystem + Process
- Configuration: +Argparse
- Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail

Module system fixes:
- OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no
  longer depends on the alphabetical discovery order of src/ subdirs
  (Testing -> Text would have been silently dropped).
- Every header-only module now has a tracked module.cmake; previously the
  empty src/<Name> marker dirs were untracked, so a fresh clone would have
  silently skipped those modules.
- VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT.

Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files
prefixed: ResultBasic etc.). Test count verified identical (831) before and
after. README/CLAUDE.md module tables updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Fable 5 committed 2026-06-12 18:50:02 +03:00
1 parent da2e93c405
commit 28b94883fd
156 files changed
+278 -220

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
#pragma once
#include <concepts>
#include <format>
#include <string>
#include <type_traits>
#if __has_include(<meta>) && defined(__cpp_consteval)
#include <meta>
#define VOID_RESULT_HAS_REFLECTION 1
#endif
namespace Void::Result::Detail
{
/// Render a value for diagnostic / log output.
///
/// Resolution order:
/// 1. If a `std::formatter<T>` exists, use `std::format("{}", v)`.
/// 2. Otherwise, if `T` exposes a `.format()` method returning
/// something convertible to `std::string`, call it.
/// 3. Otherwise, if C++26 reflection is available, walk the
/// non-static data members of `T` and render
/// `Type{field1: value1, field2: value2}`.
/// 4. Otherwise, return `"<unrepresentable>"`.
template <typename T> [[nodiscard]] std::string repr(const T& value);
template <typename T>
concept Formattable = std::formattable<T, char>;
template <typename T>
concept HasFormatMethod = requires(const T& v) {
{ v.format() } -> std::convertible_to<std::string>;
};
#ifdef VOID_RESULT_HAS_REFLECTION
template <typename T> [[nodiscard]] std::string reflect_struct(const T& obj)
{
std::string out;
if constexpr (std::meta::has_identifier(^^T)) {
out += std::meta::identifier_of(^^T);
} else {
out += "?";
}
out += '{';
static constexpr auto members =
std::define_static_array(std::meta::nonstatic_data_members_of(
^^T, std::meta::access_context::unchecked()));
bool first = true;
template for (constexpr auto member : members)
{
if (!first) {
out += ", ";
}
out += std::meta::identifier_of(member);
out += ": ";
out += repr(obj.[:member:]);
first = false;
}
out += '}';
return out;
}
#endif
template <typename T> [[nodiscard]] std::string repr(const T& value)
{
if constexpr (Formattable<T>) {
return std::format("{}", value);
} else if constexpr (HasFormatMethod<T>) {
return std::string{value.format()};
}
#ifdef VOID_RESULT_HAS_REFLECTION
else if constexpr (std::is_class_v<T> || std::is_union_v<T>) {
return reflect_struct(value);
}
#endif
else {
return "<unrepresentable>";
}
}
} // namespace Void::Result::Detail