pytorch/torch/csrc/jit/generic_if.h
Edward Z. Yang 670ec4bc59 Split Type into its own header file.
No other substantive changes.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
2017-09-20 12:24:27 -04:00

18 lines
629 B
C++

// TODO: I'm pretty sure Constness can be done with C++ templates, ala
// std::is_const, but no time to work it out...
#define GENERIC_IF(Constness, FullKind, x, Kind) \
auto && __match_key = x; \
switch(__match_key->kind()) { \
case FullKind: { \
auto * value = static_cast<Constness ::torch::jit::Kind*>(__match_key); (void) value;
#define GENERIC_ELSEIF(Constness, FullKind, Kind) \
} break; \
case FullKind: { \
auto * value = static_cast<Constness ::torch::jit::Kind*>(__match_key); (void) value;
#define GENERIC_ELSE() \
} break; \
default: {
#define GENERIC_END() \
} break; \
};