Add emplace type example
This commit is contained in:
1 parent
c6f71fddc7
commit
f5934a6274
1 file changed
+6
@@ -37,6 +37,10 @@ mpz_hash(const mpz_t z)
|
|||||||
HASH(mpz_hash), \
|
HASH(mpz_hash), \
|
||||||
OUT_STR( API( mpz_out_str, VOID, ARG1, 10, ARG2)), \
|
OUT_STR( API( mpz_out_str, VOID, ARG1, 10, ARG2)), \
|
||||||
IN_STR( API( mpz_inp_str, GT(0), ARG1, ARG2, 10)), \
|
IN_STR( API( mpz_inp_str, GT(0), ARG1, ARG2, 10)), \
|
||||||
|
EMPLACE_TYPE( LIST( (_si, mpz_init_set_si, int), \
|
||||||
|
(_ui, mpz_init_set_ui, unsigned), \
|
||||||
|
(_d, mpz_init_set_d, double), \
|
||||||
|
(_str, API(mpz_init_set_str, VOID, ARG1, ARG2, 10), const char *) )), \
|
||||||
TYPE(mpz_t) )
|
TYPE(mpz_t) )
|
||||||
|
|
||||||
/* Define a variant over two integers named integer_t
|
/* Define a variant over two integers named integer_t
|
||||||
@@ -60,6 +64,8 @@ ARRAY_DEF(my_array, my_dict_t)
|
|||||||
/* Define the oplist associated to this array of dictionary of variant and register it */
|
/* Define the oplist associated to this array of dictionary of variant and register it */
|
||||||
#define M_OPL_my_array_t() ARRAY_OPLIST(my_array, M_OPL_my_dict_t())
|
#define M_OPL_my_array_t() ARRAY_OPLIST(my_array, M_OPL_my_dict_t())
|
||||||
|
|
||||||
|
ARRAY_DEF(array_mpz, mpz_t)
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
M_LET(z, my_integer_t) /* Define & init & clear an instance of a variant of integer */
|
M_LET(z, my_integer_t) /* Define & init & clear an instance of a variant of integer */
|
||||||
|
|||||||
Reference in new issue
Block a user