diff --git a/README.md b/README.md index 094f1ef..9a981b0 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ Other configurations (macOS, aarch64, GCC, etc.) may be added in the future. ```cpp #include +using namespace rpp; + i32 main() { assert(true); info("Information"); @@ -78,24 +80,24 @@ using namespace rpp; i32 main() { Ref ref; - Box box; - Rc rc; - Arc arc; + Box box; + Rc rc; + Arc arc; Opt optional; Storage storage; - String string; + String<> string; String_View string_view; Array array; - Vec vec; - Slice slice; - Stack stack; - Queue queue; - Heap heap; + Vec vec; + Slice slice; + Stack stack; + Queue queue; + Heap heap; Map map; Pair pair; Tuple tuple; - Variant variant; - Function function; + Variant variant{0}; + Function function{[]() { return 0; }}; } ``` @@ -127,6 +129,26 @@ i32 main() { } ``` +### Trace + +```cpp +#include + +using namespace rpp; + +i32 main() { + Profile::begin_frame(); + Trace("Section") { + // ... + } + Profile::end_frame(); + + Profile::iterate_timings([](Thread::Id id, const Profile::Timing_Node& n) { + // ... + }); +} +``` + ### Reflection ```cpp @@ -153,6 +175,26 @@ i32 main() { } ``` +### Thread + +```cpp +#include +#include + +using namespace rpp; + +i32 main() { + Thread::set_priority(Thread::Priority::high); + + auto future = Thread::spawn([]() { + info("Hello from thread %!", Thread::this_id()); + return 0; + }); + + info("Thread returned: %", future->block()); +} +``` + ### Async ```cpp @@ -168,7 +210,7 @@ i32 main() { auto coro = [](Async::Pool<>& pool) -> Async::Task { co_await pool.suspend(); info("Hello from thread %!", Thread::this_id()); - co_await AsyncIO::wait(pool, 100); + co_await Async::wait(pool, 100); co_return 0; }; @@ -191,8 +233,8 @@ i32 main() { Mat4 m = Mat4::translate(v); info("Translated: %", m * v); - F32x8 simd = F32x8::set1(1.0f); - info("Dot product: %", F32x8::dot(simd, simd)); + auto simd = SIMD::F32x8::set1(1.0f); + info("Dot product: %", SIMD::F32x8::dp(simd, simd)); } ```