Skip to content

Instantly share code, notes, and snippets.

View JoshuaGross's full-sized avatar

Joshua Gross JoshuaGross

View GitHub Profile
@JoshuaGross
JoshuaGross / README.md
Created June 27, 2019 17:52
Enum conversion undefined behavior in C++
$ clang++ main.cpp -std=c++11 -o main && ./main
Converting red to string: red
Converting 2 to enum to string: yellow
Converting 20 to enum to string: undefined
Converting 20 to enum to int: 20
@JoshuaGross
JoshuaGross / bintree.rs
Created April 5, 2020 20:51
Rust binary tree + printer
use text_io::try_read;
use std::io;
use std::io::prelude::*;
use std::cmp::Ordering;
use std::fmt;
pub enum BST<T: Ord+fmt::Display> {
Leaf {
value: T,
left_child: Box<BST<T>>,