Jackalope / jlib (public) (License: GPLv3 or later) (since 2019-11-18) (hash sha1)
jlib C++ template library
Used to replace std functionality without exception handling.
- data structures
- filesystem routines
- crossplatform threads interface (currently only pthreads implementation)
- thread pool
- crossplatform dynamic memory functions interface (allocate, reallocate, deallocate) with alignment support
- high percision timer routines based on timespec
List of commits:
Subject Hash Author Date (UTC)
comments fix c07ffee6225640072ec2b064c73097f73824868e TheArtOfGriefing 2020-02-15 18:44:58
comments 610cb9723e9451e21ee23bfd2748febb1d8d5889 TheArtOfGriefing 2020-02-13 18:26:23
threads code style refactoring 3e11b789a11d4d36ba7e1515118d916d05a52a12 Jackalope 2020-02-11 03:09:19
remove several function be4d8627a56e807dd5b0675f1ae3ba9135720db1 Jackalope 2020-02-09 14:55:26
darray function insert dummy item without size checking b3bf411a1545760ee5a7dc8f5afc455335a1927e Jackalope 2020-02-04 05:35:07
make array count functions static and constexpr 272f99f2929b282513aaa529089a8f093db1c8c0 Jackalope 2020-02-01 05:42:45
grammar correction for allocate.h bf1c90dfe7335bb6e57e9bdec7833ef842c616fd TheArtOfGriefing 2020-01-27 20:09:18
changed array2D and array3D template arguments order 37f03f7de5ccc7fbc0c3c77db0b9f0c10e0dc027 jp.larry 2020-01-14 00:28:33
debug assert voiding msg on release 4fe51953aedb28bdcac8b43184dcff6bc5a7c4eb jp.larry 2020-01-10 10:49:49
max min and max constexpr c1110b3513eef049cf717f1f41782474d5e1d6fa jp.larry 2020-01-06 07:26:09
last and first functions for array 5c5883b926743d897e921f5bdeab6c71856ad2ff jp.larry 2020-01-05 03:21:48
check if cut resize size is 0 a96cfa8397b91fd00a2c2d9ba54a066a716db485 jp.larry 2019-12-29 23:05:11
darray identation change 4517cde552dc545b8de0b61f1096003e5d08143e jp.larry 2019-12-29 23:02:50
sharray identation fixed aa721791d655529b1c69060ade81c9e5f3360f51 jp.larry 2019-12-29 22:24:55
darray sorted find_or_insert function d96940317c4b701aa351930a5d7a1dd311424811 jp.larry 2019-12-29 22:21:14
darray cut_if_oversize removed from non-check functions. why it was there? 6a639746490da4059f4517b165a9238f3cb86dfd jp.larry 2019-12-29 22:20:39
new array call_all function 0f4c133956ce154804ea889107a22e79c5d61802 Jackalope 2019-12-28 15:40:51
rarray contructor from range of values a5692aeede43201f9744128a7ce9a2b227e83436 jp.larry 2019-12-28 06:33:39
array init and destroy function 8bdcbcda4f40bb9e5267f9932f52e3d84e27b2d2 jp.larry 2019-12-27 22:18:13
array call all function removed a174efc464dd51adf9cdd850a8b61f6e817016db jp.larry 2019-12-27 20:39:56
Commit c07ffee6225640072ec2b064c73097f73824868e - comments fix
Author: TheArtOfGriefing
Author date (UTC): 2020-02-15 18:44
Committer name: TheArtOfGriefing
Committer date (UTC): 2020-02-15 18:44
Parent(s): 583395015cb02914ab100392ab5c8c2454104fbd
Signer:
Signing key:
Signing status: N
Tree: 3e6bd15e5334bd9d80a75c4fa05db6082162577f
File Lines added Lines deleted
include/jlib/darray_mods.h 19 19
File include/jlib/darray_mods.h changed (mode: 100644) (index c83cb2c..c5becf2)
11 11 namespace jl namespace jl
12 12 { {
13 13 /** /**
14 * @brief Dynamic-size array with unordered access to items.
14 * @brief Dynamic-sized array with unordered access to items.
15 15 * *
16 16 * Same as darray, but some functions are optimized, * Same as darray, but some functions are optimized,
17 * considering that user does not care about position of items in array.
17 * as the position of items in array is not important to user.
18 18 * *
19 * Remove function swaps item with last item in the array, so it cannot be used in the loops.
19 * Remove function swaps item with the last item in the array, so it cannot be used in the loops.
20 20 * *
21 21 * @see darray * @see darray
22 22 */ */
 
... ... namespace jl
30 30 using typename darray::end; using typename darray::end;
31 31
32 32 /** /**
33 * @brief Call function with item from iterator position, and remove.
33 * @brief Call function with item from iterator position, and remove it.
34 34 * *
35 * Same as darray::remove, but instead of moving items, swap item with last item in the array,
35 * Same as darray::remove, but instead of moving items, swaps an item with the last item in the array,
36 36 * so it cannot be used in the loops. * so it cannot be used in the loops.
37 37 */ */
38 38 template<typename P_FOO, typename ... Args> template<typename P_FOO, typename ... Args>
 
... ... namespace jl
45 45 } }
46 46
47 47 /** /**
48 * @brief Call function with item by index, and remove.
48 * @brief Call function with item by index, and remove it.
49 49 * *
50 * Same as darray::remove, but instead of moving items, swap item with last item in the array,
50 * Same as darray::remove, but instead of moving items, swaps an item with the last item in the array,
51 51 * so it cannot be used in the loops. * so it cannot be used in the loops.
52 52 */ */
53 53 template<typename P_FOO, typename ... Args> template<typename P_FOO, typename ... Args>
 
... ... namespace jl {
63 63 template<typename T, typename G = grow_policy<>> struct darray_sorted; template<typename T, typename G = grow_policy<>> struct darray_sorted;
64 64 } }
65 65 /** /**
66 * @brief Dynamic-size array with always sorted items.
66 * @brief Dynamic-sized array which always has sorted items.
67 67 * *
68 * Same as darray, but some functions are changed, to keep items sorted.
68 * Same as darray, but some functions are modified, to keep items sorted.
69 69 * @see darray * @see darray
70 70 */ */
71 71 template<typename T, typename G> template<typename T, typename G>
 
... ... struct jl::darray_sorted : darray<T, G>
75 75 using typename darray::item; using typename darray::item;
76 76
77 77 /** /**
78 * @brief Stole allocation from darray and sort items
78 * @brief Takes allocation from darray and sorts items
79 79 * *
80 80 * Must not be called if darray_sorted already initialized. * Must not be called if darray_sorted already initialized.
81 81 * *
82 * @param p_da Pointer to darray, where from allocation
83 * will be stollen. This darray will be empty after.
82 * @param p_da Pointer to darray, where allocation
83 * will be taken from. This darray will be empty after.
84 84 */ */
85 85 void sort_darray(darray *p_da) { void sort_darray(darray *p_da) {
86 86 *this = *p_da; *this = *p_da;
 
... ... struct jl::darray_sorted : darray<T, G>
100 100 * @brief Insert single item, copied from value, to the sorted position. * @brief Insert single item, copied from value, to the sorted position.
101 101 * *
102 102 * Function will search for suitable position for item by comparing items with value to insert. * Function will search for suitable position for item by comparing items with value to insert.
103 * All items from found position to the end of the array will be moved by 1 position right,
104 * to free space for new item.
103 * All items from found position to the end of the array will be moved 1 position right,
104 * to free up the space for a new item.
105 105 * *
106 106 * T type must have overloaded ">=" operator for T type. * T type must have overloaded ">=" operator for T type.
107 107 * *
108 * @param[in] value Item value to be copited to new item in the found position.
108 * @param[in] value Item value to be copied to new item in the found position.
109 109 * @return False if reserved count is zero and memory reallocation fails. * @return False if reserved count is zero and memory reallocation fails.
110 110 * *
111 111 */ */
 
... ... struct jl::darray_sorted : darray<T, G>
117 117 } }
118 118
119 119 /** /**
120 * @brief Get pointer to item that equal to value_to_search.
120 * @brief Get pointer to an item that equal to value_to_search.
121 121 * *
122 122 * Same function as darray::find, but uses binary search, because array is sorted. * Same function as darray::find, but uses binary search, because array is sorted.
123 123 * *
 
... ... struct jl::darray_sorted : darray<T, G>
129 129 } }
130 130
131 131 /** /**
132 * @brief Get copy of item that equal to value_to_search.
132 * @brief Get a copy of an item that is equal to value_to_search.
133 133 * *
134 134 * Same function as darray::find, but uses binary search, because array is sorted. * Same function as darray::find, but uses binary search, because array is sorted.
135 135 * *
 
... ... struct jl::darray_sorted : darray<T, G>
143 143 return false; return false;
144 144 } }
145 145
146 /// @brief Search for item and insert to the sorted position, if not found.
146 /// @brief Search for item and insert it to the sorted position, if search fails.
147 147 /// @param p_p_dst Pointer to place pointer to found or inserted value. /// @param p_p_dst Pointer to place pointer to found or inserted value.
148 148 /// @return bool is value found, if false - value inserted. /// @return bool is value found, if false - value inserted.
149 149 /// @see darray_sorted::find_or_insert(const T &value, bool *p_is_found) /// @see darray_sorted::find_or_insert(const T &value, bool *p_is_found)
 
... ... struct jl::darray_sorted : darray<T, G>
156 156 } }
157 157
158 158 /** /**
159 * @brief Search for item and insert to the sorted position, if not found.
159 * @brief Search for item and insert it to the sorted position, if search fails.
160 160 * *
161 161 * T type must have overloaded ">=" and ">" operator for T type. * T type must have overloaded ">=" and ">" operator for T type.
162 162 * *
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/Jackalope/jlib

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/jlib

Clone this repository using git:
git clone git://git.rocketgit.com/user/Jackalope/jlib

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main