summaryrefslogtreecommitdiff
path: root/asl/layout.hpp
blob: 514145670cfe94443f5e08871ba9b7934dbd318e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include "asl/integers.hpp"
#include "asl/meta.hpp"

namespace asl
{

template<typename T>
inline constexpr int64_t size_of = static_cast<int64_t>(sizeof(T));

template<typename T>
inline constexpr int64_t align_of = static_cast<int64_t>(alignof(T));

struct layout
{
    int64_t size;
    int64_t align;

    constexpr bool operator==(const layout&) const = default;

    template<is_object T>
    static constexpr layout of()
    {
        return layout{ size_of<T>, align_of<T> };
    }
};

} // namespace asl