This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stddef.h> | |
#include <string> | |
// Option | |
template<typename T> | |
struct Option { | |
bool tag; | |
T value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stddef.h> | |
#include <stdbool.h> | |
// Option implementation | |
#define option(T) option_ ## T | |
#define option_method(T, M) option_ ## T ## _ ## M | |
#define option_genimpl(T) \ | |
typedef struct { \ | |
bool tag; \ |