ae2f_docs
Loading...
Searching...
No Matches
Cast.h
Go to the documentation of this file.
1/**
2 * @file Cast.h
3 * @author ae2f
4 * @brief
5 * @date 2025-02-01
6 *
7 * @copyright Copyright (c) 2025
8 *
9 */
10
11#if !defined(ae2f_Cast_h)
12
13#define ae2f_Cast_h
14
15#include "./Cast/CasterUnion.hpp"
16#include "./LangVer.auto.h"
17#include "Cxx.h"
18#include "./Guide.h"
19
20/**
21 * @def ae2f_RecordMk
22 * @brief Initialiser for trivial structures / classes.
23 * */
24#define ae2f_RecordMk(type, v)
25 (ae2f_WhenC((type){v}) ae2f_WhenCXX(type{v}))
26
27/** @brief static_cast for C++ */
28#define ae2f_static_cast(t, v)
29 ae2f_WhenC(((t)(v))) ae2f_WhenCXX(static_cast<t>(v))
30
31/** @brief dynamic_cast for C++ */
32#define ae2f_dynamic_cast(t, v)
33 ae2f_WhenC(((t)(v))) ae2f_WhenCXX(dynamic_cast<t>(v))
34
35/** @brief reinterpret_cast for C++ */
36#define ae2f_reinterpret_cast(t, v)
37 ae2f_WhenC(((t)(v))) ae2f_WhenCXX(reinterpret_cast<t>(v))
38
39/** @brief const_cast for C++ */
40#define ae2f_const_cast(t, v)
41 ae2f_WhenC(((t)(v))) ae2f_WhenCXX(const_cast<t>(v))
42
43/**
44 @brief
45 Makes a union that reads a memory in two methods. \n
46 `tThen` -> `tNow`
47 @tparam tThen
48 The existing data's type as input.
49
50 @tparam tNow
51 Wanted output datatype for casting.
52
53 @param v
54 Input value
55 */
56#define ae2f_union_cast(tThen, tNow, v)
57 ae2f_WhenC((union {
58 tThen a;
59 tNow b;
60 }){v}) ae2f_WhenCXX(ae2f_UnionCaster<tThen, tNow>(v))
61 ._b()
62#endif
#define ae2f_constexprmethod
Definition Constexpr.h:56
#define ae2f_WhenCXX(a)
Appears when the current language is C.
Definition Cxx.h:44
#define ae2f_is_cxx
Definition Cxx.h:48
#define ae2f_WhenC(a)
Appears when the current language is C++.
Definition Cxx.h:38
#define ae2f_NONE
Definition Guide.h:11
#define ae2f_stdcc_v
Standard C++ version. .
Definition LangVer.h:34
#define __ae2f_stdcheck_CC(v)
Definition LangVer.h:50
#define ae2f_PackCount
Definition Num.auto.h:6