Skip to content

Instantly share code, notes, and snippets.

@skids
skids / coerce-native
Created February 8, 2015 21:04
A deeper look at coercion.
A deeper look at coercion.
This is both an elaboration on a few points that were touched on
in ab5tract's Day 4 advent post, and a deep look at the definition
of "coerce" focusing on the soon-to-be-timely subject of buffers
and native data types, and "coercive types".
The most important part of the specification when it comes to
defining what it means to "coerce" is this (in S02):
@vendethiel
vendethiel / Any.cpp
Last active August 29, 2015 14:03
Any.cpp
#include <utility>
#include <vector>
#include <iostream>
#define ANY_OP(T, OP) bool operator OP(T el) { \
for (const auto& elem : _elems) { \
if (elem OP el) return true; \
} \
return false; \
}