Skip to content

Instantly share code, notes, and snippets.

View L0N3W0LF's full-sized avatar

Ferdinand Bermudez L0N3W0LF

  • ASML Netherlands B.V.
  • Eindhoven, Netherlands
View GitHub Profile
@L0N3W0LF
L0N3W0LF / option-and-result.cpp
Last active May 6, 2023 14:04
Rust's Option type and Result type in C++ using tagged unions
//clang 3.8.0
#include <iostream>
// Option type and Result type implementations (tagged unions).
enum class OptionType { Some, None };
template<typename T>
struct Option