mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
add a little clarification in the examples
This commit is contained in:
@@ -12,7 +12,7 @@ namespace
|
|||||||
int x;
|
int x;
|
||||||
int y;
|
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} {}
|
ivec2(int nx, int ny) : x{nx}, y{ny} {}
|
||||||
|
|
||||||
int length2() const noexcept {
|
int length2() const noexcept {
|
||||||
@@ -47,6 +47,9 @@ TEST_CASE("meta/meta_examples/inplace") {
|
|||||||
ivec2_type.get_size(),
|
ivec2_type.get_size(),
|
||||||
std::align_val_t{ivec2_type.get_align()}};
|
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)
|
// 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);
|
const meta::uvalue ivec2_ptr = ivec2_type.create_at(ivec2_buffer.get_memory(), 2, 3);
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ TEST_CASE("meta/meta_states/ctor/as_object") {
|
|||||||
const meta::class_type clazz_type = meta::resolve_type<clazz_t>();
|
const meta::class_type clazz_type = meta::resolve_type<clazz_t>();
|
||||||
REQUIRE(clazz_type);
|
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") {
|
SUBCASE("int") {
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user