A minimal tuple implementation written in C.
1 Download
2 Build
3 Example
3.1 Example output
4 Tester
5.1 Type definitions
To download tuple, execute the following command
$ git clone https://github.com/Jacob-C-Smith/tuple
To build on UNIX like machines, execute the following commands in the same directory
$ cd tuple
$ cmake .
$ make
This will build the example program, the tester program, and dynamic / shared libraries
To build tuple for Windows machines, open the base directory in Visual Studio, and build your desired target(s)
To run the example program, execute this command
$ ./tuple_example
Constructing tuple ("Dogs", "Cats", "Birds", "Fish")
[0] Dogs
[1] Cats
[2] Birds
[3] Fish
Tuple slice [1:2]
Cats
Birds
To run the tester program, execute this command after building
$ ./tuple_test
typedef struct tuple_s tuple;
// Allocaters
int tuple_create ( const tuple **const pp_tuple );
// Constructors
int tuple_construct ( tuple **const pp_tuple, size_t size );
int tuple_from_elements ( const tuple **const pp_tuple, void *const *const elements , size_t size );
int tuple_from_arguments ( const tuple **const pp_tuple, int element_count, ... );
// Accessors
int tuple_index ( const tuple *const p_tuple, signed index , void **const pp_value );
int tuple_get ( const tuple *const p_tuple, const void **const pp_elements, size_t *const p_count );
int tuple_slice ( const tuple *const p_tuple, const void **const pp_elements, signed lower_bound, signed upper_bound );
bool tuple_is_empty ( const tuple *const p_tuple );
size_t tuple_size ( const tuple *const p_tuple );
// Iterators
int tuple_foreach_i ( const tuple *const p_tuple, void (*const function)(void *const value, size_t index) );
// Destructors
int tuple_destroy ( tuple **const pp_tuple );