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 * @date 2021-10-2
6 *
7 * @copyright Copyright (c) 2020-2025
8 *
9 */
10
11#ifndef ARK_LITERALS
12#define ARK_LITERALS
13
15{
16 /**
17 * @brief Suffix to easily write uint8_t: 1_u8
18 * @param num
19 * @return uint8_t
20 */
21 inline uint8_t operator""_u8(const unsigned long long int num)
22 {
23 return static_cast<uint8_t>(num);
24 }
25
26 /**
27 * @brief Suffix to easily write uint16_t: 1_u16
28 * @param num
29 * @return uint16_t
30 */
31 inline uint16_t operator""_u16(const unsigned long long int num)
32 {
33 return static_cast<uint16_t>(num);
34 }
35
36 /**
37 * @brief Suffix to easily write std::size_t: 1_z
38 * @param num
39 * @return std::size_t
40 */
41 inline std::size_t operator""_z(const unsigned long long int num)
42 {
43 return static_cast<std::size_t>(num);
44 }
45}
46
47#endif // ARK_LITERALS