Rename filln, filla, fillan into fill_n, fill_a, fill_an (same name as C++)

This commit is contained in:
Patrick Pelissier committed 2020-03-28 11:10:02 +01:00
1 parent bdf999a9fc
commit 86b6ad54d5
3 files changed
+10 -10

No files matched your search

+3 -3
View File
@@ -6342,19 +6342,19 @@ from the position 'it2'.
Set all elements of the container 'c' to 'value'. Set all elements of the container 'c' to 'value'.
##### void name\_filln(container\_t c, size\_t n, type\_t value) ##### void name\_fill\_n(container\_t c, size\_t n, type\_t value)
Set the container to 'n' elements equal to 'value'. Set the container to 'n' elements equal to 'value'.
This method is defined only if the container exports a PUSH method. This method is defined only if the container exports a PUSH method.
##### void name\_filla(container\_t c, type\_t value, type\_t inc) ##### void name\_fill\_a(container\_t c, type\_t value, type\_t inc)
Set all elements of the container 'c' to 'value + i * inc' Set all elements of the container 'c' to 'value + i * inc'
with i = 0.. size(c) with i = 0.. size(c)
This method is defined only if the base type exports an ADD method. This method is defined only if the base type exports an ADD method.
This method is defined only if the container exports a PUSH method. This method is defined only if the container exports a PUSH method.
##### void name\_fillan(container\_t c, size\_t n, type\_t value) ##### void name\_fill\_an(container\_t c, size\_t n, type\_t value)
Set the container to 'n' elements to 'value + i * inc' Set the container to 'n' elements to 'value + i * inc'
with i = 0..n with i = 0..n
+3 -3
View File
@@ -268,7 +268,7 @@
\ \
M_IF_METHOD(PUSH, cont_oplist)( \ M_IF_METHOD(PUSH, cont_oplist)( \
static inline void \ static inline void \
M_C(name, _filln) (container_t l, size_t n, type_t const value) \ M_C(name, _fill_n) (container_t l, size_t n, type_t const value) \
{ \ { \
M_CALL_CLEAN(cont_oplist, l); \ M_CALL_CLEAN(cont_oplist, l); \
for(size_t i = 0; i < n; i++) { \ for(size_t i = 0; i < n; i++) { \
@@ -279,7 +279,7 @@
\ \
M_IF_METHOD(ADD, type_oplist)( \ M_IF_METHOD(ADD, type_oplist)( \
static inline void \ static inline void \
M_C(name, _filla) (container_t l, type_t const value, type_t const inc) \ M_C(name, _fill_a) (container_t l, type_t const value, type_t const inc) \
{ \ { \
type_t tmp; \ type_t tmp; \
M_CALL_INIT_SET(type_oplist, tmp, value); \ M_CALL_INIT_SET(type_oplist, tmp, value); \
@@ -292,7 +292,7 @@
\ \
M_IF_METHOD(PUSH, cont_oplist)( \ M_IF_METHOD(PUSH, cont_oplist)( \
static inline void \ static inline void \
M_C(name, _fillan) (container_t l, size_t n, type_t const value, type_t const inc) \ M_C(name, _fill_an) (container_t l, size_t n, type_t const value, type_t const inc) \
{ \ { \
type_t tmp; \ type_t tmp; \
M_CALL_INIT_SET(type_oplist, tmp, value); \ M_CALL_INIT_SET(type_oplist, tmp, value); \
+4 -4
View File
@@ -339,17 +339,17 @@ static void test_array(void)
assert(*array_int_get(arr, 1) == 1789); assert(*array_int_get(arr, 1) == 1789);
assert(*array_int_get(arr, 2) == 1789); assert(*array_int_get(arr, 2) == 1789);
algo_array_filla(arr, 1789, 1); algo_array_fill_a(arr, 1789, 1);
assert(*array_int_get(arr, 0) == 1789); assert(*array_int_get(arr, 0) == 1789);
assert(*array_int_get(arr, 1) == 1790); assert(*array_int_get(arr, 1) == 1790);
assert(*array_int_get(arr, 2) == 1791); assert(*array_int_get(arr, 2) == 1791);
algo_array_filla(arr, 0, 2); algo_array_fill_a(arr, 0, 2);
assert(*array_int_get(arr, 0) == 0); assert(*array_int_get(arr, 0) == 0);
assert(*array_int_get(arr, 1) == 2); assert(*array_int_get(arr, 1) == 2);
assert(*array_int_get(arr, 2) == 4); assert(*array_int_get(arr, 2) == 4);
algo_array_filln(arr, 5, 1742); algo_array_fill_n(arr, 5, 1742);
assert (array_int_size(arr) == 5); assert (array_int_size(arr) == 5);
assert(*array_int_get(arr, 0) == 1742); assert(*array_int_get(arr, 0) == 1742);
assert(*array_int_get(arr, 1) == 1742); assert(*array_int_get(arr, 1) == 1742);
@@ -357,7 +357,7 @@ static void test_array(void)
assert(*array_int_get(arr, 3) == 1742); assert(*array_int_get(arr, 3) == 1742);
assert(*array_int_get(arr, 4) == 1742); assert(*array_int_get(arr, 4) == 1742);
algo_array_fillan(arr, 4, -1, 3); algo_array_fill_an(arr, 4, -1, 3);
assert (array_int_size(arr) == 4); assert (array_int_size(arr) == 4);
assert(*array_int_get(arr, 0) == -1); assert(*array_int_get(arr, 0) == -1);
assert(*array_int_get(arr, 1) == 2); assert(*array_int_get(arr, 1) == 2);