ArkScript
A small, fast, functional and scripting language for video games
Literals.hpp
Go to the documentation of this file.
1/**
2 * @file Literals.hpp
3 * @author Alexandre Plateau ([email protected])
4 * @brief User defined literals for Ark internals
5 * @version 0.2
6 * @date 2021-10-2
7 *
8 * @copyright Copyright (c) 2020-2024
9 *
10 */
11
12#ifndef ARK_LITERALS
13#define ARK_LITERALS
14
16{
17 /**
18 * @brief Suffix to easily write uint8_t: 1_u8
19 * @param num
20 * @return uint8_t
21 */
22 inline uint8_t operator""_u8(const unsigned long long int num)
23 {
24 return static_cast<uint8_t>(num);
25 }
26
27 /**
28 * @brief Suffix to easily write uint16_t: 1_u16
29 * @param num
30 * @return uint16_t
31 */
32 inline uint16_t operator""_u16(const unsigned long long int num)
33 {
34 return static_cast<uint16_t>(num);
35 }
36
37 /**
38 * @brief Suffix to easily write std::size_t: 1_z
39 * @param num
40 * @return std::size_t
41 */
42 inline std::size_t operator""_z(const unsigned long long int num)
43 {
44 return static_cast<std::size_t>(num);
45 }
46}
47
48#endif // ARK_LITERALS