add a little clarification in the examples

This commit is contained in:
BlackMATov
2023-01-03 09:26:30 +07:00
parent 953d721511
commit 4279d7aa57
2 changed files with 5 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ namespace
int x;
int y;
ivec2(int xy) : x{xy}, y{xy} {}
explicit ivec2(int nv) : x{nv}, y{nv} {}
ivec2(int nx, int ny) : x{nx}, y{ny} {}
int length2() const noexcept {
@@ -47,6 +47,9 @@ TEST_CASE("meta/meta_examples/inplace") {
ivec2_type.get_size(),
std::align_val_t{ivec2_type.get_align()}};
// or you can use static buffer instead (if the required type is available at compile-time)
// alignas(ivec2) std::byte ivec2_buffer[sizeof(ivec2)];
// creates 'ivec2' on the memory buffer ('placement new' under the hood)
const meta::uvalue ivec2_ptr = ivec2_type.create_at(ivec2_buffer.get_memory(), 2, 3);

View File

@@ -139,7 +139,7 @@ TEST_CASE("meta/meta_states/ctor/as_object") {
const meta::class_type clazz_type = meta::resolve_type<clazz_t>();
REQUIRE(clazz_type);
alignas(alignof(clazz_t)) std::byte clazz_mem[sizeof(clazz_t)];
alignas(clazz_t) std::byte clazz_mem[sizeof(clazz_t)];
SUBCASE("int") {
{