Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 395 Bytes

tuple.org

File metadata and controls

21 lines (15 loc) · 395 Bytes

Tuple

A tuple type, generic over the two contained types.

#pragma once

#include <stdlib.h>

#define _Tuple(a, b) Tuple__ ## a ## b
#define Tuple(a, b) _Tuple(a, b)

#define DefineTuple(a, b) \
  DefineTupleStruct(a, b)

#define DefineTupleStruct(a, b) \
  typedef struct Tuple(a, b) { \
    a *fst; \
    b *snd; \
  } Tuple(a, b);