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
#![feature(unsize)] | |
use std::iter::Iterator; | |
use std::marker::Unsize; | |
use std::fmt::{self, Debug, Display}; | |
trait Heterogeneous<I: ?Sized> { | |
fn next(self: Box<Self>) -> Option<(Box<I>, Box<Heterogeneous<I>>)>; | |
fn count(&self) -> usize; |
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 <boost/variant.hpp> | |
#include "type_match.h" | |
int main(int argc, char** argv) { | |
boost::variant<int, const char*> x(42); | |
x.apply_visitor(match( | |
[](const char* value) { | |
printf("%s\n", value); // won't be called cause x is int | |
}, | |
[](int value) { |