You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-27Lines changed: 57 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,19 @@
2
2
3
3
## About
4
4
5
-
**mstd** (Maipa's Standard Library) is an extension of the C++ standard library, providing additional utility functions, new data types, and helpful templates for type comparisons. It aims to enhance the standard functionality with useful features while maintaining compatibility with modern C++. [DOCS](https://maipa01.github.io/mstd/html"Documentation")
5
+
**mstd** (Maipa's Standard Library) is an extension of the C++ standard library, providing additional utility functions,
6
+
new data types, and helpful templates for type comparisons. It aims to enhance the standard functionality with useful
7
+
features while maintaining compatibility with modern C++. [DOCS](https://maipa01.github.io/mstd/html"Documentation")
6
8
7
9
## Requirements
8
10
9
-
-**C++ Standard**: The library is designed for **C++20** and later.
11
+
-**C++ Standard**: The library is designed for **C++17** and later.
10
12
-**Supported Platforms**: The library is intended to work on **Windows, macOS, and Linux**.
11
13
12
-
13
14
## Options
15
+
14
16
### Compilation defines options
17
+
15
18
You can enable option using `#define option_name` or use cmake `set(option_name ON CACHE BOOL)`
16
19
17
20
| Cmake option/C++ define Name | Description | Default |
@@ -24,13 +27,15 @@ You can enable option using `#define option_name` or use cmake `set(option_name
24
27
|`MSTD_ENABLE_EXTRA_MACROS`| enables external macros | OFF |
25
28
26
29
### External libraries options
30
+
27
31
If you want to use external libraries not installed by project using CPM
|`MSTD_FMT_EXTERNAL`| Enable if you want to use own fmt library (tested and compatible fmt version: 12.1.0) | OFF |
32
36
33
37
### Project developing options
38
+
34
39
These options are used while testing or changing code in project
35
40
36
41
| Cmake option Name | Description | Default |
@@ -47,45 +52,67 @@ These options are used while testing or changing code in project
47
52
-**Extended String Manipulation**: Additional functions for modifying and handling strings.
48
53
-**Terminal Utilities**: Functions for clearing the terminal and retrieving its dimensions.
49
54
-**New Data Structures**:
50
-
-`ordered_map`: A map that preserves the insertion order, similar to `vector`.
51
-
-`ordered_set`: A set that maintains insertion order, like `vector`.
52
-
-`stable_vector`: A vector with stable indexes
55
+
-`ordered_map`: A map that preserves the insertion order, similar to `vector`.
56
+
-`ordered_set`: A set that maintains insertion order, like `vector`.
57
+
-`stable_vector`: A vector with stable indexes
53
58
-**Safe Arithmetic Operations**: Functions for performing arithmetic with overflow detection:
54
-
-`add_overflow`
55
-
-`sub_overflow`
56
-
-`mul_overflow`
57
-
-`div_overflow`
58
-
-**Type Comparisons for Functions**: Templates that allow comparing function types, treating lambdas and function pointers as equivalent when they share the same signature.
59
-
-**Managment Utilities**:
60
-
-`flags`: A class which represents multiple values of given flag-like enum
61
-
-`id_manager`: Manager which helps with managing ids
62
-
-`assert`: Macros for easy defining your own assert
59
+
-`add_overflow`
60
+
-`sub_overflow`
61
+
-`mul_overflow`
62
+
-`div_overflow`
63
+
-**Type Comparisons for Functions**: Templates that allow comparing function types, treating lambdas and function
64
+
pointers as equivalent when they share the same signature.
65
+
-**Management Utilities**:
66
+
-`flags`: A class which represents multiple values of given flag-like enum
67
+
-`id_manager`: Manager which helps with managing ids
68
+
-`assert`: Macros for easy defining your own assert
63
69
-**Events**:
64
-
-`events_handler`: Event handler
70
+
-`events_handler`: Event handler
71
+
72
+
## Installation
73
+
74
+
After installing, you can use `find_package(mstd)`.
75
+
76
+
### Components
77
+
78
+
You can also include components `find_pcakage(mstd COMPONENTS comp)`. They work the same way as [Compilation defines options](#compilation-defines-options), but
79
+
they provide separate components you need to include.
Before including the `mstd.hpp` or `macros.hpp` header, you can define certain macros to enable specific sets of utility functions and features within the library.
92
+
Before including the `mstd.hpp` or `macros.hpp` header, you can define certain macros to enable specific sets of utility
93
+
functions and features within the library.
69
94
70
95
### Available Macros:
71
96
72
-
-**USE_FOR_EACH_MACROS**: This macro enables access to the `DO_FOR_EACH` macro, which allows you to iterate over multiple elements and apply a function to each element.
97
+
-**MSTD_ENABLE_FOR_EACH_MACROS**: This macro enables access to the `DO_FOR_EACH` macro, which allows you to iterate over
98
+
multiple elements and apply a function to each element.
- **USE_ENUMS_MACROS**: This macro enables access to the `ENUM` macro, which allows you to define enums or enum classes along with helper functions such as `to_string()` and `size<Enum>()`.
110
+
- **MSTD_ENABLE_ENUMS_MACROS**: This macro enables access to the `ENUM` macro, which allows you to define enums or enum classes
111
+
along with helper functions such as `to_string()` and `size<Enum>()`.
85
112
86
113
Example usage:
87
114
```cpp
88
-
#define USE_ENUMS_MACROS
115
+
#define MSTD_ENABLE_ENUMS_MACROS
89
116
#include <mstd/mstd.hpp>
90
117
91
118
// Defining an enum using ENUM macro
@@ -96,11 +123,13 @@ Before including the `mstd.hpp` or `macros.hpp` header, you can define certain m
96
123
std::cout << size<Color>() << std::endl; // Outputs: 3 (the number of elements in the enum)
97
124
```
98
125
99
-
- **USE_CLONE_FUNC_MACROS**: This macro enables access to macros that help you define basic cloning functions like `Clone()` and `CloneTo()` for your custom classes. Specifically, it uses the `CloneFuncInClassDefinition` macro to automatically generate the `Clone()` function that returns a pointer to a cloned object.
126
+
- **MSTD_ENABLE_CLONE_FUNC_MACROS**: This macro enables access to macros that help you define basic cloning functions like
127
+
`Clone()` and `CloneTo()` for your custom classes. Specifically, it uses the `CloneFuncInClassDefinition` macro to
128
+
automatically generate the `Clone()` function that returns a pointer to a cloned object.
100
129
101
130
Example usage:
102
131
```cpp
103
-
#defineUSE_CLONE_FUNC_MACROS
132
+
#defineMSTD_ENABLE_CLONE_FUNC_MACROS
104
133
#include<mstd/mstd.hpp>
105
134
106
135
// Example of a class with Clone() function returning a pointer using CloneFuncInClassDefinition macro
@@ -121,9 +150,9 @@ Before including the `mstd.hpp` or `macros.hpp` header, you can define certain m
121
150
To enable these macros, define them before including `mstd.hpp`:
122
151
123
152
```cpp
124
-
#define USE_FOR_EACH_MACROS
125
-
#define USE_ENUMS_MACROS
126
-
#define USE_CLONE_FUNC_MACROS
153
+
#define MSTD_ENABLE_FOR_EACH_MACROS
154
+
#define MSTD_ENABLE_ENUMS_MACROS
155
+
#define MSTD_ENABLE_CLONE_FUNC_MACROS
127
156
#include <mstd/mstd.hpp>
128
157
```
129
158
@@ -192,4 +221,5 @@ int main() {
192
221
193
222
## License
194
223
195
-
This project is licensed under the **BSD 3-Clause License with Attribution Requirement**. See the [`LICENSE`](./LICENSE) file for more details.
224
+
This project is licensed under the **BSD 3-Clause License with Attribution Requirement**. See the [LICENSE](./LICENSE"License")
0 commit comments